Changeset 448


Ignore:
Timestamp:
Jun 11, 2012, 11:43:32 AM (12 years ago)
Author:
sommeria
Message:

bug corrected in output dir
BATCH mode implemented: still a problem to solve for writing the content of InputTable? in the xml file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r446 r448  
    12751275set(handles.RUN,'BackgroundColor',[1 0 0])
    12761276set(handles.RUN,'enable','on')
     1277set(handles.BATCH,'BackgroundColor',[1 0 0])
     1278set(handles.BATCH,'enable','on')
    12771279
    12781280%------------------------------------------------------------------------
     
    12821284set(handles.BATCH, 'Enable','Off')
    12831285set(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);
     1287if ~isempty(errormsg)
     1288    msgbox_uvmat('ERROR',errormsg)
     1289    return
     1290end
     1291path_series=fileparts(which('series'));
     1292filename_xml=fullfile(Series.OutputDir,[Series.OutputRootFile '.xml']);
     1293filename_bat=fullfile(Series.OutputDir,[Series.OutputRootFile '.bat']);
    12891294[fid,message]=fopen(filename_bat,'w');
    12901295if isequal(fid,-1)
    1291     errormsg= ['creation of .bat file: ' message];
     1296    msgbox_uvmat('ERROR', ['creation of .bat file: ' message]);
    12921297    return
    12931298end
     
    12961301    '. /etc/sysprofile \n'...
    12971302    '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'...
    13001305    'exit \n'...
    13011306    'END_MATLAB \n'];
     
    13051310    system(['chmod +x ' filename_bat]);
    13061311end
    1307 
     1312set(handles.BATCH, 'Enable','On')
     1313set(handles.BATCH,'BackgroundColor',[1 0 0])
    13081314%------------------------------------------------------------------------
    13091315% --- Executes on button press in BIN.
     
    14101416        Series.InputTable=Series.InputTable(iview,:);
    14111417    end
    1412     detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),'file')==2;% test if  the dir  already exist
     1418    detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),'dir');% test if  the dir  already exist
    14131419    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,'');
    14221436    Series.OutputSubDir=SubDirOutNew;
    14231437    Series.OutputDir=fullfile(Series.InputTable{1,1},Series.OutputSubDir);%directory set for output results
    14241438    Series.OutputRootFile=Series.InputTable{1,3};% the first sorted RootFile taken for output
     1439    set(handles.OutputDirExt,'String',Series.OutputDirExt)
    14251440    Series=rmfield(Series,'OutputDirExt');%removes redondant information
    14261441    % 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
    14321443        [tild,msg1]=mkdir(Series.OutputDir);
    14331444        if ~strcmp(msg1,'')
Note: See TracChangeset for help on using the changeset viewer.