Changeset 558
- Timestamp:
- Nov 7, 2012, 10:20:15 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_file_series.m
r554 r558 64 64 %% possibly include the first index in the root name, if there exists a corresponding xml file 65 65 r=regexp(NomType,'^(?<tiretnum>_?\d+)','names');%look for a number or _1 at the beginning of NomType 66 if ~isempty(r) 66 if ~isempty(r) %if NomType begins by a number or _1 67 67 fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput 68 68 if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not detected … … 73 73 if ~isempty(rr) 74 74 RootFile_i=[RootFile rr.i1];% new root file 75 %look for an xml file correspoonding to the new root name 75 76 if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || (strcmp(FileExt,'.nc') && exist(fullfile(RootPath,[RootFile_i '.xml']),'file')) 76 77 RootFile=RootFile_i; … … 86 87 %% analyse the list of existing files when relevant 87 88 sep1=''; 89 sep2=''; 88 90 i1_str='(?<i1>)';%will set i1=[]; 89 91 i1_star=''; … … 95 97 j2_star=''; 96 98 %Look for cases with letter indexing for the second index 97 r=regexp(NomType,'^(?<sep1>_?)(?<i1>\d+)(?< j1>[a|A])(?<j2>[b|B]?)$','names');99 r=regexp(NomType,'^(?<sep1>_?)(?<i1>\d+)(?<sep2>_?)(?<j1>[a|A])(?<j2>[b|B]?)$','names'); 98 100 if ~isempty(r) 99 101 sep1=r.sep1; 102 sep2=r.sep2; 100 103 i1_str='(?<i1>\d+)'; 104 i1_star='*'; 101 105 if strcmp(lower(r.j1),r.j1)% lower case index 102 106 j1_str='(?<j1>[a-z])'; … … 133 137 end 134 138 end 135 detect_string=['^' RootFile sep1 i1_str i2_str j1_str j2_str FileExt '$'];%string used in regexp to detect file indices139 detect_string=['^' RootFile sep1 i1_str i2_str sep2 j1_str j2_str FileExt '$'];%string used in regexp to detect file indices 136 140 %find the string used to extract the relevant files with the command dir 137 star_string=[RootFile sep1 i1_star i2_star j1_star j2_star FileExt];141 star_string=[RootFile sep1 i1_star i2_star sep2 j1_star j2_star FileExt]; 138 142 wd=pwd;%current working directory 139 143 cd (FilePath)% move to the local dir to save time in the operation dir.
Note: See TracChangeset
for help on using the changeset viewer.