Changeset 448
- Timestamp:
- Jun 11, 2012, 11:43:32 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r446 r448 1275 1275 set(handles.RUN,'BackgroundColor',[1 0 0]) 1276 1276 set(handles.RUN,'enable','on') 1277 set(handles.BATCH,'BackgroundColor',[1 0 0]) 1278 set(handles.BATCH,'enable','on') 1277 1279 1278 1280 %------------------------------------------------------------------------ … … 1282 1284 set(handles.BATCH, 'Enable','Off') 1283 1285 set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784]) 1284 [h_fun,errormsg]=prepare_jobs(handles); 1285 set(handles.BATCH, 'Enable','On') 1286 set(handles.BATCH,'BackgroundColor',[1 0 0]) 1287 path_civ=fileparts(which('civ')); 1288 filename_bat=[OutputFile '.bat']; 1286 [h_fun,Series,errormsg]=prepare_jobs(handles); 1287 if ~isempty(errormsg) 1288 msgbox_uvmat('ERROR',errormsg) 1289 return 1290 end 1291 path_series=fileparts(which('series')); 1292 filename_xml=fullfile(Series.OutputDir,[Series.OutputRootFile '.xml']); 1293 filename_bat=fullfile(Series.OutputDir,[Series.OutputRootFile '.bat']); 1289 1294 [fid,message]=fopen(filename_bat,'w'); 1290 1295 if isequal(fid,-1) 1291 errormsg= ['creation of .bat file: ' message];1296 msgbox_uvmat('ERROR', ['creation of .bat file: ' message]); 1292 1297 return 1293 1298 end … … 1296 1301 '. /etc/sysprofile \n'... 1297 1302 'matlab -nodisplay -nosplash -nojvm <<END_MATLAB \n'... 1298 'cd(''' path_ civ'''); \n'...1299 ' civ_matlab(''' filename_xml ''',''' OutputFile '.nc''); \n'...1303 'cd(''' path_series '''); \n'... 1304 '' Series.Action '( ''' filename_xml '''); \n'... 1300 1305 'exit \n'... 1301 1306 'END_MATLAB \n']; … … 1305 1310 system(['chmod +x ' filename_bat]); 1306 1311 end 1307 1312 set(handles.BATCH, 'Enable','On') 1313 set(handles.BATCH,'BackgroundColor',[1 0 0]) 1308 1314 %------------------------------------------------------------------------ 1309 1315 % --- Executes on button press in BIN. … … 1410 1416 Series.InputTable=Series.InputTable(iview,:); 1411 1417 end 1412 detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),' file')==2;% test if the dir already exist1418 detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),'dir');% test if the dir already exist 1413 1419 while detect 1414 r=regexp(SubDirOut,'(?<root>.*\D)(?<num1>\d+)$','names');%detect whether name ends by a number 1415 if isempty(r) 1416 r(1).root=[SubDirOut '_']; 1417 r(1).num1='0'; 1418 end 1419 SubDirOutNew=[r(1).root num2str(str2num(r(1).num1)+1)];%increment the index by 1 or put 1 1420 detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),'file')==2;% test if the dir already exists 1421 end 1420 answer=msgbox_uvmat('INPUT_Y-N',['use existing ouput directory: ' fullfile(Series.InputTable{1,1},SubDirOutNew) ', possibly delete previous data']); 1421 if isequal(answer,'Yes') 1422 detect=0; 1423 check_create=0; 1424 else 1425 r=regexp(SubDirOutNew,'(?<root>.*\D)(?<num1>\d+)$','names');%detect whether name ends by a number 1426 if isempty(r) 1427 r(1).root=[SubDirOutNew '_']; 1428 r(1).num1='0'; 1429 end 1430 SubDirOutNew=[r(1).root num2str(str2num(r(1).num1)+1)];%increment the index by 1 or put 1 1431 detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),'dir');% test if the dir already exists 1432 check_create=1; 1433 end 1434 end 1435 Series.OutputDirExt=regexprep(SubDirOutNew,Series.OutputSubDir,''); 1422 1436 Series.OutputSubDir=SubDirOutNew; 1423 1437 Series.OutputDir=fullfile(Series.InputTable{1,1},Series.OutputSubDir);%directory set for output results 1424 1438 Series.OutputRootFile=Series.InputTable{1,3};% the first sorted RootFile taken for output 1439 set(handles.OutputDirExt,'String',Series.OutputDirExt) 1425 1440 Series=rmfield(Series,'OutputDirExt');%removes redondant information 1426 1441 % create output directory 1427 answer='No'; 1428 if exist(Series.OutputDir,'dir') 1429 answer=msgbox_uvmat('INPUT_Y-N',['use existing ouput directory: ' Series.OutputDir ', possibly delete previous data']); 1430 end 1431 if ~isequal(answer,'Yes') 1442 if check_create 1432 1443 [tild,msg1]=mkdir(Series.OutputDir); 1433 1444 if ~strcmp(msg1,'')
Note: See TracChangeset
for help on using the changeset viewer.