Changeset 442 for trunk/src/series/aver_stat.m
- Timestamp:
- Jun 6, 2012, 2:46:15 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/aver_stat.m
r420 r442 45 45 if ischar(Param) && ~isempty(find(regexp('Param','.xml$'))) 46 46 Param=xml2struct(Param); 47 checkrun=0; 47 48 else % RUN case: parameters introduced as the input structure Param 48 49 hseries=guidata(Param.hseries);%handles of the GUI series 49 50 WaitbarPos=get(hseries.waitbar_frame,'Position'); 51 checkrun=1; 50 52 end 51 53 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); … … 250 252 ext_out='.nc'; 251 253 end 252 subdir_result='aver_stat';%subdirectory for the results 253 pathdir=fullfile(RootPath{1},subdir_result);% full subdirectory name, including path 254 testexist=1; 255 while testexist 256 pathdir=fullfile(RootPath{1},subdir_result);% full subdirectory name, including path 257 if NbSlice==1% keep track of the first and lsat indices of the input files 258 %NomTypeOut=nomtype2pair(Param.InputTable{1,4},i2_series{end}(end)-i1_series{1}(1),j2_series{end}(end)-j1_series{1}(1)); 259 NomTypeOut='_1-2'; 260 fileresult{1}=fullfile_uvmat(RootPath{1},subdir_result,RootFile{1},ext_out,NomTypeOut,i1_series{1}(1),i1_series{1}(end),[],[]); 261 testexist=exist(fileresult{1},'file'); 262 else % simplified indexing with i_slice for multiple slices 263 testexist=0; 264 for i_slice=1:NbSlice 265 fileresult{1}=fullfile_uvmat(RootPath{1},subdir_result,RootFile{1},ext_out,NomTypeOut,i_slice,[],[],[]); 266 if exist(fileresult{i_slice},'file') 267 testexist=1; 268 break 269 end 270 end 271 end 272 if testexist 273 subdir_result=[subdir_result '.0']; 274 end 275 end 254 subdir_result=[SubDir{1} '.stat'];%subdirectory for the results 255 pathdir=RootPath{1};% full subdirectory name, including path 256 checkdetect=1; 257 while checkdetect %create a new subdir if the netcdf files already exist 258 checkdetect=exist(fullfile(pathdir,subdir_result)); 259 if checkdetect% if a nesult dir already exists 260 r=regexp(subdir_result,'(?<root>.*\D)(?<num1>\d+)$','names');%detect whether name ends by a number 261 if isempty(r) 262 r(1).root=[subdir_result '_']; 263 r(1).num1='0'; 264 end 265 subdir_result=[r(1).root num2str(str2num(r(1).num1)+1)];%increment the index by 1 or put 1 266 end 267 end 268 NomTypeOut='_1-2'; 269 fileresult{1}=fullfile_uvmat(RootPath{1},subdir_result,RootFile{1},ext_out,NomTypeOut,i1_series{1}(1),i1_series{1}(end),[],[]); 270 271 % A REPRNDRE CAS MULTI-NIVEAU: 272 % pathdir=fullfile(RootPath{1},subdir_result);% full subdirectory name, including path 273 % if NbSlice==1% keep track of the first and lsat indices of the input files 274 % %NomTypeOut=nomtype2pair(Param.InputTable{1,4},i2_series{end}(end)-i1_series{1}(1),j2_series{end}(end)-j1_series{1}(1)); 275 % NomTypeOut='_1-2'; 276 % fileresult{1}=fullfile_uvmat(RootPath{1},subdir_result,RootFile{1},ext_out,NomTypeOut,i1_series{1}(1),i1_series{1}(end),[],[]); 277 % testexist=exist(fileresult{1},'file'); 278 % else % simplified indexing with i_slice for multiple slices 279 % testexist=0; 280 % for i_slice=1:NbSlice 281 % fileresult{1}=fullfile_uvmat(RootPath{1},subdir_result,RootFile{1},ext_out,NomTypeOut,i_slice,[],[],[]); 282 % if exist(fileresult{i_slice},'file') 283 % testexist=1; 284 % break 285 % end 286 % end 287 % end 288 % if testexist 289 % subdir_result=[subdir_result '.0']; 290 % end 291 % end 276 292 % create result directory if needed 277 if ~exist( pathdir,'dir')278 [m1,m2,m3]=mkdir( pathdir);293 if ~exist(fullfile(RootPath{1},subdir_result),'dir') 294 [m1,m2,m3]=mkdir(fullfile(RootPath{1},subdir_result)); 279 295 if ~isequal(m2,'') 280 296 msgbox_uvmat('CONFIRMATION',m2);%error message for directory creation 281 297 end 282 298 end 283 [xx,msg2] = fileattrib( pathdir,'+w','g'); %yield writing access (+w) to user group (g)299 [xx,msg2] = fileattrib(fullfile(RootPath{1},subdir_result),'+w','g'); %yield writing access (+w) to user group (g) 284 300 if ~strcmp(msg2,'') 285 msgbox_uvmat('ERROR',['pb of permission for ' pathdir': ' msg2])%error message for writting access301 msgbox_uvmat('ERROR',['pb of permission for ' fullfile(RootPath{1},subdir_result) ': ' msg2])%error message for writting access 286 302 return 287 303 end … … 312 328 % if isequal(stopstate,'queue') % enable STOP command 313 329 % update_waitbar(hseries.waitbar,WaitbarPos,index/(nbfield*nbfield2)) 330 if checkrun 331 update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield*nbfield2)) 332 stopstate=get(hseries.RUN,'BusyAction'); 333 else 334 stopstate='queue'; 335 end 314 336 ifile=indselect(index); 315 337 % reading input file(s)
Note: See TracChangeset
for help on using the changeset viewer.