Changeset 398 for trunk/src/find_file_series.m
- Timestamp:
- Apr 26, 2012, 12:12:43 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_file_series.m
r397 r398 1 1 %'find_file_series': check the content of an input file and find the corresponding file series 2 2 %-------------------------------------------------------------------------- 3 % function [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object ]=find_file_series(fileinput)3 % function [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object,i1_input,i2_input,j1_input,j2_input]=find_file_series(fileinput) 4 4 % 5 5 % OUTPUT: … … 37 37 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 38 38 39 function [Root File,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(RootPath,fileinput)39 function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput) 40 40 %------------------------------------------------------------------------ 41 if ~exist('option','var') 42 option='all'; 43 end 41 44 42 %% get input root name and nomenclature type 45 [tild,tild,RootFile,tild,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fileinput); 46 fullfileinput=fullfile(RootPath,fileinput);% input file name with path 43 fullfileinput=fullfile(FilePath,fileinput);% input file name with path 44 [RootPath,SubDir,RootFile,i1_input,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fullfileinput); 45 47 46 48 47 %% check for particular file types: images, movies, civ data … … 58 57 end 59 58 60 if strcmp(NomType,'')||strcmp(NomType,'*') ||strcmp(option,'filetype')59 if strcmp(NomType,'')||strcmp(NomType,'*') 61 60 if exist(fullfileinput,'file') 62 % RootFile=fileinput;% case of constant name (no indexing) 63 [tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing) 61 [tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing), get the filename without its extension 64 62 else 65 63 RootFile=''; 66 64 end 65 i1_input=1;% the index now refer to the frame in the movie, choose 1 at opening 66 i2_input=[]; 67 j1_input=[]; 68 j2_input=[]; 67 69 else 68 70 %% possibly include the first index in the root name, if there exists a corresponding xml file 69 % RootFileNew=RootFile;70 % if ~isempty(regexp(NomType,['^_']))71 % NomTypePref='_';72 % RootFileNew=[RootFileNew '_'];73 % end RootPath='';74 71 NomTypePref=''; 75 72 r=regexp(NomType,'^(?<tiretnum>_?\d+)','names');%look for a number or _1 at the beginning of NomType 76 % r=regexp(NomType,['^' NomTypePref '(?<num1>\d+)'],'names');%look for a number at the beginning of NomTypeSt77 73 if ~isempty(r) 78 74 fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput … … 85 81 RootFileNew=[RootFile rr.i1]; 86 82 checkpair=~isempty(regexp(NomType,'-','once'))||~isempty(regexp(NomType,'ab$','once'))||~isempty(regexp(NomType,'AB$','once'));%case of PIV results 87 if exist(fullfile(RootPath,[RootFileNew '.xml']),'file') || (checkpair && exist(fullfile(fileparts(RootPath),[RootFileNew '.xml']),'file'))83 if exist(fullfile(RootPath,[RootFileNew '.xml']),'file') %|| (checkpair && exist(fullfile(fileparts(RootPath),[RootFileNew '.xml']),'file')) 88 84 RootFile=RootFileNew; 89 85 NomTypePref=r.tiretnum; 90 86 NomType=regexprep(NomType,['^' NomTypePref],''); 87 i1_input=j1_input; 91 88 i2_input=j2_input; 92 89 j1_input=[]; … … 151 148 star_string=[RootFile sep1 i1_star i2_star j1_star j2_star FileExt]; 152 149 wd=pwd;%current working directory 153 cd ( RootPath)% move to the local dir to save time in the operation dir.150 cd (FilePath)% move to the local dir to save time in the operation dir. 154 151 dirpair=dir(star_string);% look for relevant files in the file directory 155 152 cd(wd) … … 158 155 ref_j_list=zeros(1,nbpair); 159 156 if nbpair==0% no detected file 160 % RootPath='';161 157 RootFile=''; 162 158 end
Note: See TracChangeset
for help on using the changeset viewer.