Changeset 1131 for trunk/src/fileparts_uvmat.m
- Timestamp:
- Apr 11, 2024, 7:30:52 PM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/fileparts_uvmat.m
r1127 r1131 94 94 delim2=r.delim2; 95 95 num3=r.num3; 96 ipair=1; 97 jpair=1; 96 98 switch delim1 97 99 case '_' … … 101 103 i1=str2double(num3); 102 104 i2=str2double(num2); 105 if i2<=i1 106 ipair=0; 107 end 103 108 end 104 109 case '-' 105 110 j1=str2double(num2); 106 111 j2=str2double(num1); 112 if j2<=j1 113 jpair=0; 114 end 107 115 switch delim2 108 116 case '_' … … 110 118 end 111 119 end 120 if ipair && jpair 112 121 NomType=[get_type(num3) delim2 get_type(num2) delim1 get_type(num1)]; 113 122 RootFile=regexprep(FileName,[num3 delim2 num2 delim1 num1 '$'],''); 123 else 124 if ipair==0 125 i1=i2; 126 i2=[]; 127 NomType=[get_type(num2) delim1 get_type(num1)]; 128 RootFile=regexprep(FileName,[ num2 delim1 num1 '$'],''); 129 elseif jpair==0 130 j1=j2; 131 j2=[]; 132 NomType=get_type(num1); 133 RootFile=regexprep(FileName,[num1 '$'],''); 134 end 135 end 136 114 137 else 138 ipair=1; 115 139 switch delim1 116 140 case '_' … … 120 144 i1=str2double(num2); 121 145 i2=str2double(num1); 122 end 146 if i2<=i1 147 ipair=0; 148 end 149 end 150 if ipair 123 151 NomType=[get_type(num2) delim1 get_type(num1)]; 124 152 RootFile=regexprep(FileName,[num2 delim1 num1 '$'],''); 153 else 154 i1=i2; 155 i2=[];% no pair detected if i2<=i1 156 NomType= get_type(num1); 157 RootFile=regexprep(FileName,[ num1 '$'],''); 158 end 125 159 end 126 160 NomType=regexprep(NomType,'-1','-2'); %set 1-2 instead of 1-1 … … 152 186 153 187 %% suppress '_' at the end of RootFile, put it on NomType 154 % if strcmp(RootFile(end),'_') 155 % RootFile(end)=[]; 156 detect=regexp(RootFile,'_$'); %detect '_' at the end of RootFILE 188 detect=regexp(RootFile,'_$','once'); %detect '_' at the end of RootFILE 157 189 if ~isempty(detect) 158 190 RootFile=regexprep(RootFile,'_$',''); … … 161 193 162 194 %% extract subdirectory for pairs i1-i2 or j1-j2 (or ab, AB) 163 % if ~isempty(i2) || ~isempty(j2)164 195 r=regexp(RootPath,'\<(?<newrootpath>.+)(\\|/)(?<subdir>[^\\^/]+)(\\|/)*\>','names'); 165 196 if ~isempty(r) … … 167 198 RootPath=r.newrootpath; 168 199 end 169 % end170 200 171 201
Note: See TracChangeset
for help on using the changeset viewer.