Changeset 825


Ignore:
Timestamp:
Nov 23, 2014, 10:51:26 AM (6 years ago)
Author:
sommeria
Message:

series modified to have more general output dir options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r824 r825  
    528528set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
    529529xx=double(get(handles.series,'CurrentCharacter')); %get the keyboard character
     530if ~isempty(xx)
    530531switch xx
    531532    case 31 %downward arrow
     
    544545        end
    545546end
    546 
     547end
    547548
    548549%------------------------------------------------------------------------
     
    14511452
    14521453%% create the output data directory if needed
     1454OutpuDir='';
    14531455if isfield(Param,'OutputSubDir')
    14541456    SubDirOut=[get(handles.OutputSubDir,'String') Param.OutputDirExt];
     
    14911493        end
    14921494    end
    1493     OutputNomType=nomtype2pair(Param.InputTable{1,4});% nomenclature for output files
    1494     DirXml=fullfile(OutputDir,'0_XML');
    1495     if ~exist(DirXml,'dir')
    1496         [tild,msg1]=mkdir(DirXml);
    1497         if ~strcmp(msg1,'')
    1498             msgbox_uvmat('ERROR',['cannot create ' DirXml ': ' msg1]);%error message for directory creation
    1499             return
    1500         end
    1501         [success,msg] = fileattrib(DirXml,'+w','g','s');% allow writing access for the group of users, recursively in the folder
    1502         if success==0
    1503             msgbox_uvmat('WARNING',{['unable to set group write access to ' DirXml ':']; msg});%error message for directory creation
    1504         end
    1505     end
    1506 end
    1507        
     1495   
     1496elseif isfield(Param,'ActionInput')&&isfield(Param.ActionInput,'LogPath')% custom definition of the output dir
     1497    OutputDir=Param.ActionInput.LogPath;   
     1498end
     1499DirXml=fullfile(OutputDir,'0_XML');
     1500if ~exist(DirXml,'dir')
     1501    [tild,msg1]=mkdir(DirXml);
     1502    if ~strcmp(msg1,'')
     1503        msgbox_uvmat('ERROR',['cannot create ' DirXml ': ' msg1]);%error message for directory creation
     1504        return
     1505    end
     1506    [success,msg] = fileattrib(DirXml,'+w','g','s');% allow writing access for the group of users, recursively in the folder
     1507    if success==0
     1508        msgbox_uvmat('WARNING',{['unable to set group write access to ' DirXml ':']; msg});%error message for directory creation
     1509    end
     1510end
     1511OutputNomType=nomtype2pair(Param.InputTable{1,4});% nomenclature for output files
     1512
    15081513%% get the set of reference field indices
    15091514first_i=1;
     
    16101615        end
    16111616    end
    1612 elseif strcmp(get(handles.OutputDirExt,'Visible'),'off')
    1613     msgbox_uvmat('ERROR',['no output file for Action ' ActionName ', use run mode = local']);% a output dir is needed for background option
    1614     return
     1617% elseif strcmp(get(handles.OutputDirExt,'Visible'),'off')
     1618%     msgbox_uvmat('ERROR',['no output file for Action ' ActionName ', use run mode = local']);% a output dir is needed for background option
     1619%     return
    16151620else
    16161621    %% processing on a different session of the same computer (background) or cluster, create executable files
     
    21682173
    21692174%% definition of the directory containing the output files
     2175SubDirOut='';%default
     2176OutputDirExt='series'; %default
     2177if isfield(ParamOut,'OutputDirExt')&&~isempty(ParamOut.OutputDirExt)
     2178    OutputDirExt=ParamOut.OutputDirExt;
     2179end
     2180set(handles.OutputDirExt,'String',OutputDirExt)
    21702181OutputDirVisible='off';
    2171 if isfield(ParamOut,'OutputDirExt')&&  ~isequal(ActionIndex,1)%&&~isempty(ParamOut.OutputDirExt)
    2172     OutputSubDirMode='all';%default
    2173     if isfield(ParamOut,'OutputSubDirMode')
    2174         OutputSubDirMode=ParamOut.OutputSubDirMode;
    2175     end
    2176     set(handles.OutputDirExt,'String',ParamOut.OutputDirExt)
    2177     OutputDirVisible='on';
    2178     SubDir=InputTable(1:end,2); %set of subdirectories sorted in alphabetical order
    2179     if strcmp(OutputSubDirMode,'last')
    2180         SubDirOut=SubDir{end};
    2181     else
     2182OutputSubDirMode='auto';%default
     2183if isfield(ParamOut,'OutputSubDirMode')
     2184    OutputSubDirMode=ParamOut.OutputSubDirMode;
     2185end
     2186switch OutputSubDirMode
     2187    case 'auto';%default
     2188        OutputDirVisible='on';
     2189        SubDir=InputTable(1:end,2); %set of subdirectories sorted in alphabetical order
    21822190        SubDirOut=SubDir{1};
    2183         if ~strcmp(OutputSubDirMode,'first')  && numel(SubDir)>1
     2191        if numel(SubDir)>1
    21842192            for ilist=2:numel(SubDir)
    21852193                SubDirOut=[SubDirOut '-' SubDir{ilist}];
    21862194            end
    21872195        end
    2188     end
    2189     if isfield(ParamOut,'OutputSubDir')
    2190         SubDirOut=ParamOut.OutputSubDir;
    2191     end
    2192     set(handles.OutputSubDir,'String',SubDirOut)
    2193 end
    2194 
     2196    case 'first'
     2197        OutputDirVisible='on';
     2198        SubDirOut=InputTable{1,2}; %use the first subdir name (+OutputDirExt) as output  subdirectory
     2199    case 'last'
     2200        OutputDirVisible='on';
     2201        SubDirOut=InputTable{end,2}; %use the last subdir name (+OutputDirExt) as output  subdirectory
     2202end
     2203set(handles.OutputSubDir,'String',SubDirOut)
    21952204set(handles.OutputDirExt,'Visible',OutputDirVisible)
    21962205set(handles.OutputSubDir,'Visible',OutputDirVisible)
    21972206set(handles.OutputDir_title,'Visible',OutputDirVisible)
    2198 set(handles.RunMode,'Visible',OutputDirVisible)
    2199 set(handles.ActionExt,'Visible',OutputDirVisible)
    2200 set(handles.RunMode_title,'Visible',OutputDirVisible)
    2201 set(handles.ActionExt_title,'Visible',OutputDirVisible)
     2207
     2208%% visibility of the run mode (local or background or cluster)
     2209if strcmp(OutputSubDirMode,'none')
     2210    RunModeVisible='off';% only local mode available if no output file is produced
     2211else
     2212     RunModeVisible='on';
     2213end
     2214set(handles.RunMode,'Visible',RunModeVisible)
     2215set(handles.ActionExt,'Visible',RunModeVisible)
     2216set(handles.RunMode_title,'Visible',RunModeVisible)
     2217set(handles.ActionExt_title,'Visible',RunModeVisible)
    22022218
    22032219
     
    29522968    RootPath=Param.InputTable{1,1};
    29532969    if ~isfield(Param,'OutputSubDir')   
    2954         msgbox_uvmat('ERROR','no directory defined for output files')
     2970        msgbox_uvmat('ERROR','no standard sub-directory definition for output files, use a browser to check the output')
    29552971        return
    29562972    end
Note: See TracChangeset for help on using the changeset viewer.