Changeset 961 for trunk/src/fullfile_uvmat.m
- Timestamp:
- Jun 28, 2016, 9:05:33 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/fullfile_uvmat.m
r924 r961 76 76 end 77 77 if isequal(i1,i2) 78 i2=[];% suppress the seco dnindex if equal to the first78 i2=[];% suppress the second index if equal to the first 79 79 end 80 80 if ~exist('i1','var') … … 93 93 94 94 %% look for NomType with pairs (separator '-' or terminasion ab or AB 95 if ~isempty(regexp(NomType,'^_\d')) 96 sep1='_'; 97 NomType(1)=[];%remove '_' from the beginning of NomType 98 end 99 r=regexp(NomType,'^(?<num1>\d+)','names');%look for a number at the beginning of NomType 100 if ~isempty(r) 101 i1_str=num2str(i1,['%0' num2str(length(r.num1)) 'd']); 102 NomType=regexprep(NomType,['^' r.num1],''); 103 r=regexp(NomType,'^-(?<num2>\d+)','names');%look for a pair i1-i2 104 if ~isempty(r) 105 if ~isempty(i2) 106 sep2='-'; 107 i2_str=num2str(i2,['%0' num2str(length(r.num2)) 'd']); 108 end 109 NomType=regexprep(NomType,['^-' r.num2],''); 110 end 111 if ~isempty(regexp(NomType,'^_')); 112 sep3='_'; 95 if strcmp(NomType,'level')% organisation with a sub-folder for the files of each index i 96 filename=fullfile(RootPath,SubDir,['level' num2str(j1)],[RootFile num2str(i1) FileExt]); 97 else 98 if ~isempty(regexp(NomType,'^_\d')) 99 sep1='_'; 113 100 NomType(1)=[];%remove '_' from the beginning of NomType 114 101 end 115 if ~isempty(regexp(NomType,'^[a|A]')); 116 j1_str=num2stra(j1,NomType); 117 if ~isempty(regexp(NomType,'[b|B]$'))&& ~isempty(j2); 118 j2_str=num2stra(j2,NomType); 102 r=regexp(NomType,'^(?<num1>\d+)','names');%look for a number at the beginning of NomType 103 if ~isempty(r) 104 i1_str=num2str(i1,['%0' num2str(length(r.num1)) 'd']); 105 NomType=regexprep(NomType,['^' r.num1],''); 106 r=regexp(NomType,'^-(?<num2>\d+)','names');%look for a pair i1-i2 107 if ~isempty(r) 108 if ~isempty(i2) 109 sep2='-'; 110 i2_str=num2str(i2,['%0' num2str(length(r.num2)) 'd']); 111 end 112 NomType=regexprep(NomType,['^-' r.num2],''); 119 113 end 120 else 121 r=regexp(NomType,'^(?<num3>\d+)','names'); 122 if ~isempty(r) 123 j1_str=num2str(j1,['%0' num2str(length(r.num3)) 'd']); 124 NomType=regexprep(NomType,['^' r.num3],''); 114 if ~isempty(regexp(NomType,'^_')); 115 sep3='_'; 116 NomType(1)=[];%remove '_' from the beginning of NomType 125 117 end 126 if ~isempty(j2) 127 r=regexp(NomType,'-(?<num4>\d+)','names'); 128 if ~isempty(r) 129 sep4='-'; 130 j2_str=num2str(j2,['%0' num2str(length(r.num4)) 'd']); 131 end 118 if ~isempty(regexp(NomType,'^[a|A]')); 119 j1_str=num2stra(j1,NomType); 120 if ~isempty(regexp(NomType,'[b|B]$'))&& ~isempty(j2); 121 j2_str=num2stra(j2,NomType); 122 end 123 else 124 r=regexp(NomType,'^(?<num3>\d+)','names'); 125 if ~isempty(r) 126 j1_str=num2str(j1,['%0' num2str(length(r.num3)) 'd']); 127 NomType=regexprep(NomType,['^' r.num3],''); 128 end 129 if ~isempty(j2) 130 r=regexp(NomType,'-(?<num4>\d+)','names'); 131 if ~isempty(r) 132 sep4='-'; 133 j2_str=num2str(j2,['%0' num2str(length(r.num4)) 'd']); 134 end 135 end 132 136 end 133 137 end 138 filename=fullfile(RootPath,SubDir,RootFile); 139 filename=[filename sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str]; 140 filename=[regexprep(filename,'_$','') FileExt];%suppress possible '_' at the end of the string and add the extension 134 141 end 135 filename=fullfile(RootPath,SubDir,RootFile);136 filename=[filename sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str];137 filename=[regexprep(filename,'_$','') FileExt];%suppress possible '_' at the end of the string and add the extension138 139 142 140 143 function test
Note: See TracChangeset
for help on using the changeset viewer.