[81c116]: / script_create_save_path_name.m

Download this file

41 lines (35 with data), 1.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
% Location of the path to save results
% You may modify this script to save the file to a path of your preference.
function save_path = script_create_save_path_name(file_name, condition_Bmode)
% Protocol D
% str1 = strsplit(file_name, 'Experiment_Data/');
% str1_TEMP = strsplit(str1{2}, '/supine_US');
% if( size(str1_TEMP, 2) == 1)
% str1_TEMP = strsplit(str1{2}, '/tilted_US');
% end
% if( size(str1_TEMP, 2) == 1 )
% save_path = [];
% fprintf('Error in the filename\n');
% return;
% end
% subject_ID = str1_TEMP{1};
% str = strsplit(file_name, 'US/');
% str_2 = strsplit(str{1}, '_MIT/');
% Protocol E
str = strsplit(file_name, filesep);
if condition_Bmode
% condition_Bmode is true if the input file is a BMODE image
% Protocol D
%save_path = fullfile(sprintf('%sUS', str{1}), sprintf('%s_%sDIA_ECG_%s.mat', subject_ID, str_2{2}, str{2}));
% Protocol E and MGH study
save_name = strcat(str{end-1}, '_supine_DIA_ECG_', str{end}, '.mat');
save_path = fullfile(str{1:end-1}, save_name);
else
% condition_Bmode is false if the input file is a Pulsed-Doppler
% Protocol D
%save_path = fullfile(sprintf('%sUS', str{1}), sprintf('%s_%sVEL_ECG_%s.mat', subject_ID, str_2{2}, str{2}));
% Protocol E
save_name = strcat(str{end-1}, '_supine_VEL_ECG_', str{end}, '.mat');
save_path = fullfile(str{1:end-1}, save_name);
end
end