Changeset 992 for trunk/src


Ignore:
Timestamp:
Feb 2, 2017, 10:37:19 PM (4 years ago)
Author:
g7moreau
Message:
  • replace ;% by ; %
Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/compile.m

    r977 r992  
    2525
    2626function compile (FctName,SubfctPath)
    27 hh=[];% handles of message display window
     27hh=[]; % handles of message display window
    2828if isempty(which('mcc'))
    2929    msgbox_uvmat('ERROR','no Matlab compiler toolbox mcc installed')
     
    4141end
    4242if ~isempty(SubfctPath)
    43     SubfctPath=['-I ' SubfctPath];%string indicating the option of including the path SubfctPath
     43    SubfctPath=['-I ' SubfctPath]; % string indicating the option of including the path SubfctPath
    4444end
    4545[mcrmajor, mcrminor] = mcrversion;   
     
    4747FctNameVersion=[FctName,'_',MCRROOT];
    4848%hver=ver('MATLAB');
    49 %FctNameVersion=[FctName '_MCRROOT' regexprep(hver.Version,'\.','')];%suppress the dot in version number
     49%FctNameVersion=[FctName '_MCRROOT' regexprep(hver.Version,'\.','')]; % suppress the dot in version number
    5050try
    5151    disp(['mcc -m -R -nojvm -R -nodisplay -R -singleCompThread ' SubfctPath ' ' FctName '.m'])
    5252    eval(['mcc -m -R -nojvm -R -nodisplay -R -singleCompThread ' SubfctPath ' ' FctName '.m'])% compile the source file [FctName .m], which produces a binary file FctName and a cmd file [run_' FctName '.sh]
    53     system(['mv -f ' FctName ' bin/']);%move the binary file FctName to the subdir /bin
    54     system(['sed -e ''''s#/' FctName '#/bin/' FctName '#'''' run_' FctName '.sh > ' FctNameVersion '.sh']);%modify the cmd file and copy it to [FctName '.sh']
    55     system(['rm run_' FctName '.sh']);% remove the initial cmd file [run_' FctName '.sh]
     53    system(['mv -f ' FctName ' bin/']); % move the binary file FctName to the subdir /bin
     54    system(['sed -e ''''s#/' FctName '#/bin/' FctName '#'''' run_' FctName '.sh > ' FctNameVersion '.sh']); % modify the cmd file and copy it to [FctName '.sh']
     55    system(['rm run_' FctName '.sh']); % remove the initial cmd file [run_' FctName '.sh]
    5656    system(['chmod +x ' FctNameVersion '.sh']); % set the cmd file to 'executable'
    5757catch ME
  • trunk/src/series.m

    r991 r992  
    7272% position and  size of the GUI at opening
    7373set(0,'Unit','points')
    74 ScreenSize=get(0,'ScreenSize');%size of the current screen, in points (1/72 inch)
    75 Width=900;% prefered width of the GUI in points (1/72 inch)
    76 Height=624;% prefered height of the GUI in points (1/72 inch)
     74ScreenSize=get(0,'ScreenSize'); % size of the current screen, in points (1/72 inch)
     75Width=900; % prefered width of the GUI in points (1/72 inch)
     76Height=624; % prefered height of the GUI in points (1/72 inch)
    7777%adjust to screen size (reduced by a min margin)
    7878RescaleFactor=min((ScreenSize(3)-80)/Width,(ScreenSize(4)-80)/Height);
     
    8282Width=Width*RescaleFactor;
    8383Height=Height*RescaleFactor;
    84 LeftX=80*RescaleFactor;%position of the left fig side, in pixels (put to the left side, with some margin)
     84LeftX=80*RescaleFactor; % position of the left fig side, in pixels (put to the left side, with some margin)
    8585LowY=round(ScreenSize(4)/2-Height/2); % put at the middle height on the screen
    8686set(hObject,'Units','points')
     
    129129% check default input data
    130130if ~exist('Param','var')
    131     Param=[]; %default
     131    Param=[]; % default
    132132end
    133133
    134134%% list of builtin functions in the mebu ActionName
    135 ActionList={'check_data_files';'aver_stat';'time_series';'civ_series';'merge_proj'};% WARNING: fits with nb_builtin_ACTION=4 in ActionName_callback
     135ActionList={'check_data_files';'aver_stat';'time_series';'civ_series';'merge_proj'}; % WARNING: fits with nb_builtin_ACTION=4 in ActionName_callback
    136136NbBuiltinAction=numel(ActionList);
    137137set(handles.Action,'UserData',NbBuiltinAction)
    138 [path_series,name,ext]=fileparts(which('series'));% path to the GUI series
    139 path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series'
     138[path_series,name,ext]=fileparts(which('series')); % path to the GUI series
     139path_series_fct=fullfile(path_series,'series'); % path of the functions in subdirectroy 'series'
    140140[code, message] = system...
    141141    ('LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | pyp "p.split('':'') |... [s for s in p if ''matlab'' not in s] | '':''.join(p)") python -c "import fluidimage"');
    142142if code==0
    143     ActionExtList={'.m';'.sh';'.py (in dev.)'};% default choice of extensions (Matlab fct .m or compiled version .sh
     143    ActionExtList={'.m';'.sh';'.py (in dev.)'}; % default choice of extensions (Matlab fct .m or compiled version .sh
    144144else
    145145    ActionExtList={'.m';'.sh'};  % python options not installed
    146146end
    147 ActionPathList=cell(NbBuiltinAction,1);%initiate the cell matrix of Action fct paths
    148 ActionPathList(:)={path_series_fct}; %set the default path to series fcts to all list members
    149 RunModeList={'local';'background'};% default choice of extensions (Matlab fct .m or compiled version .sh)
    150 [s,w]=system('oarstat');% look for cluster system 'oar'
     147ActionPathList=cell(NbBuiltinAction,1); % initiate the cell matrix of Action fct paths
     148ActionPathList(:)={path_series_fct}; % set the default path to series fcts to all list members
     149RunModeList={'local';'background'}; % default choice of extensions (Matlab fct .m or compiled version .sh)
     150[s,w]=system('oarstat'); % look for cluster system 'oar'
    151151if isequal(s,0)
    152152    RunModeList=[RunModeList;{'cluster_oar'}];
     
    155155    set(handles.CPUTime_txt,'Visible','on'); % make visible button for access to Monika
    156156end
    157 [s,w]=system('qstat -help');% look for cluster system 'sge'
     157[s,w]=system('qstat -help'); % look for cluster system 'sge'
    158158if isequal(s,0)
    159159    if regexp(w,'^pbs')
     
    168168
    169169%% list of builtin transform functions in the menu TransformName
    170 TransformList={'';'sub_field';'phys';'phys_polar'};% WARNING: must fit with the corresponding menu in uvmat and nb_builtin_transform=4 in  TransformName_callback
     170TransformList={'';'sub_field';'phys';'phys_polar'}; % WARNING: must fit with the corresponding menu in uvmat and nb_builtin_transform=4 in  TransformName_callback
    171171NbBuiltinTransform=numel(TransformList);
    172172path_transform_fct=fullfile(path_series,'transform_field');
    173 TransformPathList=cell(NbBuiltinTransform,1);%initiate the cell matrix of Action fct paths
    174 TransformPathList(:)={path_transform_fct}; %set the default path to series fcts to all list members
     173TransformPathList=cell(NbBuiltinTransform,1); % initiate the cell matrix of Action fct paths
     174TransformPathList(:)={path_transform_fct}; % set the default path to series fcts to all list members
    175175
    176176%% get the user defined functions stored in the personal file uvmat_perso.mat
     
    208208
    209209%% selection of the input Action fct
    210 ActionCheckExist=true(size(ActionList));%initiate the check of the path to the listed action fct
     210ActionCheckExist=true(size(ActionList)); % initiate the check of the path to the listed action fct
    211211for ilist=NbBuiltinAction+1:numel(ActionList)%check  the validity of the path of the user defined Action fct
    212212    ActionCheckExist(ilist)=exist(fullfile(ActionPathList{ilist},[ActionList{ilist} '.m']),'file');
    213213end
    214 ActionPathList=ActionPathList(ActionCheckExist,:);% suppress the menu options which are not valid anymore
     214ActionPathList=ActionPathList(ActionCheckExist,:); % suppress the menu options which are not valid anymore
    215215ActionList=ActionList(ActionCheckExist);
    216216set(handles.ActionName,'String',[ActionList;{'more...'}])
     
    249249%% fields input initialisation
    250250if isfield(Param,'list_fields')&& isfield(Param,'index_fields') &&~isempty(Param.list_fields) &&~isempty(Param.index_fields)
    251     set(handles.FieldName,'String',Param.list_fields);% list menu fields
    252     set(handles.FieldName,'Value',Param.index_fields);% selected string index
     251    set(handles.FieldName,'String',Param.list_fields); % list menu fields
     252    set(handles.FieldName,'Value',Param.index_fields); % selected string index
    253253end
    254254if isfield(Param,'Coordinates')
     
    264264end
    265265% if isfield(Param,'Coord_x_str') && ischar(Param.Coord_x_str)
    266 %         set(handles.Coord_x,'String',Param.Coord_x_str);% list menu fields
     266%         set(handles.Coord_x,'String',Param.Coord_x_str); % list menu fields
    267267% end
    268268% if isfield(Param,'Coord_y_str')&& ischar(Param.Coord_y_str)
    269 %         set(handles.Coord_y,'String',Param.Coord_y_str);% list menu fields
     269%         set(handles.Coord_y,'String',Param.Coord_y_str); % list menu fields
    270270% end
    271271
     
    276276    %% fill the list of file series
    277277    InputTable=[{Param.InputFile.RootPath},{Param.InputFile.SubDir},{Param.InputFile.RootFile},{Param.InputFile.NomType},{Param.InputFile.FileExt}];
    278     if isempty(find(cellfun('isempty',InputTable)==0));% if there is no input file, do not introduce input info
     278    if isempty(find(cellfun('isempty',InputTable)==0)); % if there is no input file, do not introduce input info
    279279        set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
    280280        return
     
    295295        i2=i1;
    296296    end
    297     ref_i=floor((i1+i2)/2);% reference image number corresponding to the file
     297    ref_i=floor((i1+i2)/2); % reference image number corresponding to the file
    298298    % set(handles.num_ref_i,'String',num2str(ref_i));
    299299    if isempty(j1)
     
    303303        j2=j1;
    304304    end
    305     ref_j=floor((j1+j2)/2);% reference image number corresponding to the file
     305    ref_j=floor((j1+j2)/2); % reference image number corresponding to the file
    306306    SeriesData.ref_i=ref_i;
    307307    SeriesData.ref_j=ref_j;
     
    444444        {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}];
    445445    str_find=strcmp(get(hObject,'Label'),MenuFile);
    446     MenuFile(str_find)=[];% suppress the input file to the list
     446    MenuFile(str_find)=[]; % suppress the input file to the list
    447447    for ifile=1:numel(MenuFile)
    448448        set(handles.(['MenuFile_' num2str(ifile)]),'Label',MenuFile{ifile});
     
    483483end
    484484
    485 OutPut=browse_data(oldfile,'on','on');% open the GUI browse_data to get select a campaign dir, experiment and device
     485OutPut=browse_data(oldfile,'on','on'); % open the GUI browse_data to get select a campaign dir, experiment and device
    486486NbLines=numel(OutPut.Experiment)*numel(OutPut.DataSeries);
    487487icount=0;
     
    524524% --------------------------------------------------------------------
    525525
    526 OutPut=browse_data(get(hObject,'Label'),'on','on');% open the GUI browse_data to get select a campaign dir, experiment and device
     526OutPut=browse_data(get(hObject,'Label'),'on','on'); % open the GUI browse_data to get select a campaign dir, experiment and device
    527527if ~isfield(OutPut,'Campaign')
    528528    return
     
    581581set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
    582582set(handles.OutputSubDir,'BackgroundColor',[1 0 1])% set edit box OutputSubDir to magenta color to indicate that refresh may be needed
    583 xx=double(get(handles.series,'CurrentCharacter')); %get the keyboard character
     583xx=double(get(handles.series,'CurrentCharacter')); % get the keyboard character
    584584if ~isempty(xx)
    585585    switch xx
     
    588588            iline=str2double(get(handles.InputLine,'String'));
    589589            if isequal(iline,size(InputTable,1))% arrow downward
    590                 InputTable=[InputTable;InputTable(iline,:)];% create a new line as a copy of the last one
     590                InputTable=[InputTable;InputTable(iline,:)]; % create a new line as a copy of the last one
    591591                set(handles.InputTable,'Data',InputTable);
    592592            end
     
    609609end
    610610if ~isempty(find(empty_line));
    611     InputTable(empty_line,:)=[];%remove empty lines
     611    InputTable(empty_line,:)=[]; % remove empty lines
    612612    set(handles.InputTable,'Data',InputTable)
    613613    ListTable={'MinIndex_i','MaxIndex_i','MinIndex_j','MaxIndex_j','PairString','TimeTable'};
    614614    for ilist=1:numel(ListTable)
    615615        Table=get(handles.(ListTable{ilist}),'Data');
    616         Table(empty_line,:)=[];%remove empty lines
     616        Table(empty_line,:)=[]; % remove empty lines
    617617        set(handles.(ListTable{ilist}),'Data',Table);
    618618    end
     
    644644
    645645%% update MinIndex_i and MaxIndex_i if the input table content has been reduced in line nbre
    646 MinIndex_i_table=get(handles.MinIndex_i,'Data');%retrieve the min indices in the table MinIndex
     646MinIndex_i_table=get(handles.MinIndex_i,'Data'); % retrieve the min indices in the table MinIndex
    647647set(handles.MinIndex_i,'Data',MinIndex_i_table(1:nbview,:));
    648 MinIndex_j_table=get(handles.MinIndex_j,'Data');%retrieve the min indices in the table MinIndex
     648MinIndex_j_table=get(handles.MinIndex_j,'Data'); % retrieve the min indices in the table MinIndex
    649649set(handles.MinIndex_j,'Data',MinIndex_j_table(1:nbview,:));
    650 MaxIndex_i_table=get(handles.MaxIndex_i,'Data');%retrieve the min indices in the table MinIndex
     650MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); % retrieve the min indices in the table MinIndex
    651651
    652652set(handles.MaxIndex_i,'Data',MaxIndex_i_table(1:nbview,:));
    653 MaxIndex_j_table=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex
     653MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); % retrieve the min indices in the table MinIndex
    654654set(handles.MaxIndex_j,'Data',MaxIndex_j_table(1:nbview,:));
    655 PairString=get(handles.PairString,'Data');%retrieve the min indices in the table MinIndex
     655PairString=get(handles.PairString,'Data'); % retrieve the min indices in the table MinIndex
    656656set(handles.PairString,'Data',PairString(1:nbview,:));
    657 TimeTable=get(handles.TimeTable,'Data');%retrieve the min indices in the table MinIndex
     657TimeTable=get(handles.TimeTable,'Data'); % retrieve the min indices in the table MinIndex
    658658set(handles.TimeTable,'Data',TimeTable(1:nbview,:));
    659659
     
    680680set(handles.REFRESH,'BackgroundColor',[1 1 0])% set REFRESH  button to yellow color (indicate activation)
    681681drawnow
    682 errormsg='';%default
     682errormsg=''; % default
    683683if ischar(Param)
    684684    fileinput=Param;
     
    741741SeriesData=get(handles.series,'UserData');
    742742if strcmp(iview,'append') % display the input data as a new line in the table
    743     iview=size(InputTable,1)+1;% the next line in InputTable becomes the current line
     743    iview=size(InputTable,1)+1; % the next line in InputTable becomes the current line
    744744%     InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    745745elseif strcmp(iview,'one') % refresh the list of  input  file series
    746     iview=1; %the first line in InputTable becomes the current line
     746    iview=1; % the first line in InputTable becomes the current line
    747747    InputTable={'','','','',''};
    748748%     InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
     
    753753    set(handles.MaxIndex_j,'Data',[])
    754754    set(handles.PairString,'Data',{''})
    755     SeriesData.CheckPair=0;%reset the list of input lines with pairs
     755    SeriesData.CheckPair=0; % reset the list of input lines with pairs
    756756    SeriesData.i1_series={};
    757757    SeriesData.i2_series={};
     
    784784    i2=i1;
    785785end
    786 ref_i=floor((i1+i2)/2);% reference image number corresponding to the file
     786ref_i=floor((i1+i2)/2); % reference image number corresponding to the file
    787787% set(handles.num_ref_i,'String',num2str(ref_i));
    788788if isempty(j1)
     
    792792    j2=j1;
    793793end
    794 ref_j=floor((j1+j2)/2);% reference image number corresponding to the file
     794ref_j=floor((j1+j2)/2); % reference image number corresponding to the file
    795795SeriesData.ref_i=ref_i;
    796796SeriesData.ref_j=ref_j;
     
    824824str_find=strcmp(fileinput,MenuFile);
    825825if isempty(find(str_find,1))
    826     MenuFile=[{fileinput};MenuFile];%insert the current file if not already in the list
     826    MenuFile=[{fileinput};MenuFile]; % insert the current file if not already in the list
    827827end
    828828for ifile=1:min(length(MenuFile),5)
     
    832832profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    833833if exist(profil_perso,'file')
    834     save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat
     834    save (profil_perso,'MenuFile','-append'); % store the file names for future opening of uvmat
    835835else
    836     save (profil_perso,'MenuFile','-V6'); %store the file names for future opening of uvmat
     836    save (profil_perso,'MenuFile','-V6'); % store the file names for future opening of uvmat
    837837end
    838838% save the opened file to initiate future opening
    839 SeriesData.RefFile{iview}=fileinput;% reference opening file for line iview
     839SeriesData.RefFile{iview}=fileinput; % reference opening file for line iview
    840840SeriesData.Ref_i1=i1;
    841841SeriesData.Ref_i2=i2;
     
    865865%% display the min and max indices for the whole file series
    866866if size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0
    867     MinIndex_j=1;% index j set to 1 by default
     867    MinIndex_j=1; % index j set to 1 by default
    868868    MaxIndex_j=1;
    869     MinIndex_i=find(i1_series(1,2,:), 1 )-1;% min ref index i detected in the series (corresponding to the first non-zero value of i1_series, except for zero index)
    870     MaxIndex_i=find(i1_series(1,2,:),1,'last' )-1;%max ref index i detected in the series (corresponding to the last non-zero value of i1_series)
     869    MinIndex_i=find(i1_series(1,2,:), 1 )-1; % min ref index i detected in the series (corresponding to the first non-zero value of i1_series, except for zero index)
     870    MaxIndex_i=find(i1_series(1,2,:),1,'last' )-1; % max ref index i detected in the series (corresponding to the last non-zero value of i1_series)
    871871else
    872     ref_i=squeeze(max(i1_series(1,:,:),[],2));% select ref_j index for each ref_i
    873     ref_j=squeeze(max(j1_series(1,:,:),[],3));% select ref_i index for each ref_j
     872    ref_i=squeeze(max(i1_series(1,:,:),[],2)); % select ref_j index for each ref_i
     873    ref_j=squeeze(max(j1_series(1,:,:),[],3)); % select ref_i index for each ref_j
    874874     MinIndex_i=min(find(ref_i))-1;
    875875     MaxIndex_i=max(find(ref_i))-1;
     
    891891    MinIndex_j=0;
    892892end
    893 MinIndex_i_table=get(handles.MinIndex_i,'Data');%retrieve the min indices in the table MinIndex
    894 MinIndex_j_table=get(handles.MinIndex_j,'Data');%retrieve the min indices in the table MinIndex
    895 MaxIndex_i_table=get(handles.MaxIndex_i,'Data');%retrieve the min indices in the table MinIndex
    896 MaxIndex_j_table=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex
     893MinIndex_i_table=get(handles.MinIndex_i,'Data'); % retrieve the min indices in the table MinIndex
     894MinIndex_j_table=get(handles.MinIndex_j,'Data'); % retrieve the min indices in the table MinIndex
     895MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); % retrieve the min indices in the table MinIndex
     896MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); % retrieve the min indices in the table MinIndex
    897897if ~isempty(MinIndex_i)&&~isempty(MaxIndex_i)
    898898    MinIndex_i_table(iview,1)=MinIndex_i;
     
    911911%% adjust the first and last indices for the selected series, only if requested by the bounds
    912912% i index, compare input to min index i
    913 first_i=str2num(get(handles.num_first_i,'String'));%retrieve previous first i
    914 % ref_i=str2num(get(handles.num_ref_i,'String'));%index i given by the input field
     913first_i=str2num(get(handles.num_first_i,'String')); % retrieve previous first i
     914% ref_i=str2num(get(handles.num_ref_i,'String')); % index i given by the input field
    915915ref_i=1;
    916916if isfield(SeriesData,'ref_i')
     
    918918end
    919919if isempty(first_i)
    920     first_i=ref_i;% first_i updated by the input value
     920    first_i=ref_i; % first_i updated by the input value
    921921elseif first_i < MinIndex_i
    922922    first_i=MinIndex_i; % first_i set to the min i index (restricted by oter input lines)
    923923elseif first_i >MaxIndex_i
    924     first_i=MaxIndex_i;% first_i set to the max i index (restricted by oter input lines)
     924    first_i=MaxIndex_i; % first_i set to the max i index (restricted by oter input lines)
    925925end
    926926% j index,  compare input to min index j
     
    931931end
    932932if isempty(first_j)
    933     first_j=ref_j;% first_j updated by the input value
     933    first_j=ref_j; % first_j updated by the input value
    934934elseif first_j<MinIndex_j
    935935    first_j=MinIndex_j; % first_j set to the min j index (restricted by oter input lines)
     
    961961
    962962%% number of slices set by default
    963 NbSlice=[];%default
     963NbSlice=[]; % default
    964964% read  value set by the first series for the append mode (iwiew >1)
    965965if iview>1 && strcmp(get(handles.num_NbSlice,'Visible'),'on')
     
    974974end
    975975TimeName='';
    976 Time=[];%default
     976Time=[]; % default
    977977TimeMin=[];
    978978TimeFirst=[];
     
    994994        TimeName='xml';
    995995%                         if XmlData.Time(1,:)==XmlData.Time(2,:)% case starting with index 1
    996 %                     sizDti=size(XmlData.Time,1)-1;%size of the time vector explicitly defined in the xml file
     996%                     sizDti=size(XmlData.Time,1)-1; % size of the time vector explicitly defined in the xml file
    997997%                     ind_start=1;
    998998%                 else
    999 %                     sizDti=size(XmlData.Time,1);% case starting with index 0
     999%                     sizDti=size(XmlData.Time,1); % case starting with index 0
    10001000%                     ind_start=0;
    10011001%                 end
    10021002%         % complement the input if the whole time series is not defined
    10031003%             if size(i1_series,3)>size(XmlData.Time,1)-ind_start %only the first time interval is defined, extrapolate to the whole series
    1004 %                 Dti_total=XmlData.Time(end)-XmlData.Time(1);%total time interval covered by the time vector
    1005 %                 missing_indices=sizDti+1+ind_start:size(i1_series,3)+1;% remaining set of frame indices for which time needs to be found
    1006 %                 repeat_nbre=1+floor((missing_indices-sizDti-ind_start)/(sizDti-1));% number of repetitions of Dti
     1004%                 Dti_total=XmlData.Time(end)-XmlData.Time(1); % total time interval covered by the time vector
     1005%                 missing_indices=sizDti+1+ind_start:size(i1_series,3)+1; % remaining set of frame indices for which time needs to be found
     1006%                 repeat_nbre=1+floor((missing_indices-sizDti-ind_start)/(sizDti-1)); % number of repetitions of Dti
    10071007%                 time_indices=1+mod(missing_indices-sizDti-1,sizDti-1);
    10081008%                 for j=1:size(XmlData.Time,2)
     
    10251025        %                 msgbox_uvmat('WARNING','inconsistent number of slices with the first field series');
    10261026        %             end
    1027         %             NbSlice=XmlData.Camera.NbSlice;% Nbre of slices from camera
     1027        %             NbSlice=XmlData.Camera.NbSlice; % Nbre of slices from camera
    10281028        %         end
    10291029        if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit)
     
    10641064if ~isempty(VideoObject)% case of movies
    10651065    imainfo=get(VideoObject);
    1066     if isempty(j1_series); %frame index along i
     1066    if isempty(j1_series); % frame index along i
    10671067        Time=zeros(imainfo.NumberOfFrames+1,2);
    10681068        Time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)';
     
    11231123    PairString{iview,1}=Menu{1};
    11241124else
    1125     PairString{iview,1}='';%no pair for #iview
     1125    PairString{iview,1}=''; % no pair for #iview
    11261126end
    11271127set(handles.PairString,'Data',PairString)
     
    11421142nbview=numel(SeriesData.i1_series);
    11431143j_max=cell(1,nbview);
    1144 MaxIndex_i=ones(1,nbview);%default
    1145 MinIndex_i=ones(1,nbview);%default
     1144MaxIndex_i=ones(1,nbview); % default
     1145MinIndex_i=ones(1,nbview); % default
    11461146for iline=1:nbview
    1147     pair_max=squeeze(max(SeriesData.i1_series{iline},[],1)); %max on pair index
    1148     j_max{iline}=max(pair_max,[],1);%max on j index
     1147    pair_max=squeeze(max(SeriesData.i1_series{iline},[],1)); % max on pair index
     1148    j_max{iline}=max(pair_max,[],1); % max on j index
    11491149    if ~isempty(j_max{iline})
    1150     MaxIndex_i(iline)=max(find(j_max{iline}))-1;% max ref index i
    1151     MinIndex_i(iline)=min(find(j_max{iline}))-1;% min ref index i
     1150    MaxIndex_i(iline)=max(find(j_max{iline}))-1; % max ref index i
     1151    MinIndex_i(iline)=min(find(j_max{iline}))-1; % min ref index i
    11521152    end
    11531153end
     
    11581158npx=floor(Position(3));
    11591159file_indices=MinIndex_i+floor(((0.5:npx-0.5)/npx)*range_index)+1;
    1160 CData=zeros(nbview*range_y,npx);% initiate the image representing the existing files
     1160CData=zeros(nbview*range_y,npx); % initiate the image representing the existing files
    11611161for iline=1:nbview
    11621162    ind_y=1+(iline-1)*range_y:iline*range_y;
     
    11671167    CData(ind_y,:)=ones(size(ind_y'))*LineData;
    11681168end
    1169 CData=cat(3,zeros(size(CData)),CData,zeros(size(CData)));%make color images r=0,g,b=0
     1169CData=cat(3,zeros(size(CData)),CData,zeros(size(CData))); % make color images r=0,g,b=0
    11701170set(handles.FileStatus,'CData',CData);
    11711171
     
    11871187    end
    11881188else %existence of j pairs
    1189     pair_max=squeeze(max(i1_series,[],1)); %max on pair index
     1189    pair_max=squeeze(max(i1_series,[],1)); % max on pair index
    11901190    j_max=max(pair_max,[],1);
    1191     MaxIndex_i=find(j_max, 1, 'last' )-1;% max ref index i
    1192     MinIndex_i=find(j_max, 1 )-1;% min ref index i
     1191    MaxIndex_i=find(j_max, 1, 'last' )-1; % max ref index i
     1192    MinIndex_i=find(j_max, 1 )-1; % min ref index i
    11931193    i_max=max(pair_max,[],2);
    1194     MaxIndex_j=find(i_max, 1, 'last' )-1;% max ref index i
    1195     MinIndex_j=find(i_max, 1 )-1;% min ref index i
     1194    MaxIndex_j=find(i_max, 1, 'last' )-1; % max ref index i
     1195    MinIndex_j=find(i_max, 1 )-1; % min ref index i
    11961196    if MaxIndex_j==MinIndex_j
    11971197        ModeValue=1;
     
    12031203        ModeMenu={'bursts';'series(Dj)'};
    12041204        if (MaxIndex_j-MinIndex_j)>10
    1205             ModeValue=2;%set mode to series(Dj) if more than 10 j values
     1205            ModeValue=2; % set mode to series(Dj) if more than 10 j values
    12061206        else
    12071207            ModeValue=1;
     
    12301230                if ~isempty(time)
    12311231                    if ref_i<=floor(ipair/2)
    1232                         ref_i=floor(ipair/2)+1;% shift ref_i to get the first pair
     1232                        ref_i=floor(ipair/2)+1; % shift ref_i to get the first pair
    12331233                    end
    12341234                    Dt=time(ref_i+ceil(ipair/2),ref_j)-time(ref_i-floor(ipair/2),ref_j);
     
    12541254                if ~isempty(time)
    12551255                    if ref_j<=floor(ipair/2)
    1256                         ref_j=floor(ipair/2)+1;% shift ref_i to get the first pair
     1256                        ref_j=floor(ipair/2)+1; % shift ref_i to get the first pair
    12571257                    end
    12581258                    Dt=time(ref_i,ref_j+ceil(ipair/2))-time(ref_i,ref_j-floor(ipair/2));
     
    13281328function displ_time(handles)
    13291329%------------------------------------------------------------------------
    1330 SeriesData=get(handles.series,'UserData');%
     1330SeriesData=get(handles.series,'UserData'); %
    13311331if ~isfield(SeriesData,'Time')
    13321332    return
    13331333end
    13341334PairString=get(handles.PairString,'Data');
    1335 ref_i_1=str2num(get(handles.num_first_i,'String'));%first reference index
    1336 ref_i_2=str2num(get(handles.num_last_i,'String'));%last reference index
     1335ref_i_1=str2num(get(handles.num_first_i,'String')); % first reference index
     1336ref_i_2=str2num(get(handles.num_last_i,'String')); % last reference index
    13371337ref_j_1=[];ref_j_2=[];
    13381338if strcmp(get(handles.num_first_j,'Visible'),'on')
     
    13611361            time_last=(SeriesData.Time{iview}(i1_2+1,j1_2+1)+SeriesData.Time{iview}(i2_2+1,j2_1+1))/2;
    13621362        end
    1363         TimeTable{iview,3}=time_first; %TODO: take into account pairs
    1364         TimeTable{iview,4}=time_last; %TODO: take into account pairs
     1363        TimeTable{iview,3}=time_first; % TODO: take into account pairs
     1364        TimeTable{iview,4}=time_last; % TODO: take into account pairs
    13651365    end
    13661366end
     
    13741374if isempty(pos_first), pos_first=0; end
    13751375if isempty(pos_last), pos_last=1; end
    1376 Position=get(handles.Waitbar,'Position');% position of the waitbar:= [ x,y, width, height]
     1376Position=get(handles.Waitbar,'Position'); % position of the waitbar:= [ x,y, width, height]
    13771377Position_status=get(handles.FileStatus,'Position');
    13781378Position(1)=Position_status(1)+Position_status(3)*pos_first;
    1379 Position(3)=max(Position_status(3)*(pos_last-pos_first),0.001);% width must remain positive
     1379Position(3)=max(Position_status(3)*(pos_last-pos_first),0.001); % width must remain positive
    13801380set(handles.Waitbar,'Position',Position)
    13811381update_waitbar(handles.Waitbar,0)
     
    14181418
    14191419%% settings of the button RUN
    1420 set(handles.RUN,'BusyAction','queue');% activation of STOP button will set BusyAction to 'cancel'
     1420set(handles.RUN,'BusyAction','queue'); % activation of STOP button will set BusyAction to 'cancel'
    14211421set(handles.RUN, 'Enable','Off')% avoid further RUN action until the current one is finished
    14221422set(handles.RUN,'BackgroundColor',[1 1 0])%show activation of RUN by yellow color
     
    14411441%------------------------------------------------------------------------
    14421442function errormsg=launch_action(handles)
    1443 errormsg='';%default
     1443errormsg=''; % default
    14441444
    14451445%% read the data on the GUI series
    1446 Param=read_GUI_series(handles);%displayed parameters
    1447 SeriesData=get(handles.series,'UserData');%hidden parameters
     1446Param=read_GUI_series(handles); % displayed parameters
     1447SeriesData=get(handles.series,'UserData'); % hidden parameters
    14481448if isfield(SeriesData,'TransformInput')
    14491449    Param.TransformInput=SeriesData.TransformInput;
     
    14591459
    14601460%% select the Action mode, 'local', 'background' or 'cluster' (if available)
    1461 RunMode='local';%default (needed for first opening of the GUI series)
     1461RunMode='local'; % default (needed for first opening of the GUI series)
    14621462if isfield(Param.Action,'RunMode')
    14631463    RunMode=Param.Action.RunMode;
    1464     Param.Action=rmfield(Param.Action,'RunMode');%remove from the recorded xml file to avoid interference during ImportConfig
    1465 end
    1466 ActionExt='.m';%default
     1464    Param.Action=rmfield(Param.Action,'RunMode'); % remove from the recorded xml file to avoid interference during ImportConfig
     1465end
     1466ActionExt='.m'; % default
    14671467if isfield(Param.Action,'ActionExt')
    1468     ActionExt=Param.Action.ActionExt;% '.m', '.sh' (compiled)  or '.py' (Python)
    1469     Param.Action=rmfield(Param.Action,'ActionExt');%remove from the recorded xml file to avoid interference during ImportConfig
     1468    ActionExt=Param.Action.ActionExt; % '.m', '.sh' (compiled)  or '.py' (Python)
     1469    Param.Action=rmfield(Param.Action,'ActionExt'); % remove from the recorded xml file to avoid interference during ImportConfig
    14701470end
    14711471ActionName=Param.Action.ActionName;
     
    14921492
    14931493%% Get  PARAM.xml (not used at this stage)
    1494 errormsg='';%default error message
     1494errormsg=''; % default error message
    14951495xmlfile=fullfile(path_series,'PARAM.xml');
    14961496if ~exist(xmlfile,'file')
     
    15691569switch RunMode
    15701570    case {'local','background'}
    1571         NbCore=1;% no need to split the calculation
     1571        NbCore=1; % no need to split the calculation
    15721572    case 'cluster_oar'
    15731573        %%%%% TEST A REMETTRE%%%%%
    15741574 %       if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
    1575 %             NbCore=1;% one core used only (limitation of Matlab licences)
     1575%             NbCore=1; % one core used only (limitation of Matlab licences)
    15761576%             answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
    15771577%             if ~strcmp(answer,'Yes')
     
    15911591    case {'cluster_pbs', 'cluster_sge', 'cluster_qstat_unknown'}
    15921592        if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
    1593             NbCore=1;% one core used only (limitation of Matlab licences)
     1593            NbCore=1; % one core used only (limitation of Matlab licences)
    15941594            answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
    15951595            if ~strcmp(answer,'Yes')
     
    16021602            NbCore=str2double(answer{1});
    16031603            qstat_Queue=answer{2};
    1604             %extra_oar=answer{2};%TODO : fix this for LMFA cluster. Maybe
     1604            %extra_oar=answer{2}; % TODO : fix this for LMFA cluster. Maybe
    16051605            %extrs_oar and extra_pbs are not the best names
    16061606        end
     
    16151615    SubDirOut=[get(handles.OutputSubDir,'String') Param.OutputDirExt];
    16161616    SubDirOutNew=SubDirOut;
    1617     detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir');% test if  the dir  already exist
    1618     check_create=1; %need to create the result directory by default
     1617    detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir'); % test if  the dir  already exist
     1618    check_create=1; % need to create the result directory by default
    16191619    CheckOverwrite=1;
    16201620    if isfield(Param,'CheckOverwrite')
     
    16341634            check_create=0;
    16351635        else
    1636             r=regexp(SubDirOutNew,'(?<root>.*\D)(?<num1>\d+)$','names');%detect whether name ends by a number
     1636            r=regexp(SubDirOutNew,'(?<root>.*\D)(?<num1>\d+)$','names'); % detect whether name ends by a number
    16371637            if isempty(r)
    16381638                r(1).root=[SubDirOutNew '_'];
    16391639                r(1).num1='0';
    16401640            end
    1641             SubDirOutNew=[r(1).root num2str(str2num(r(1).num1)+1)];%increment the index by 1 or put 1
    1642             detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir');% test if  the dir  already exists
     1641            SubDirOutNew=[r(1).root num2str(str2num(r(1).num1)+1)]; % increment the index by 1 or put 1
     1642            detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir'); % test if  the dir  already exists
    16431643            check_create=1;
    16441644        end
    16451645    end
    16461646    Param.OutputDirExt=regexprep(SubDirOutNew,Param.OutputSubDir,'');
    1647     Param.OutputRootFile=Param.InputTable{1,3};% the first sorted RootFile taken for output
     1647    Param.OutputRootFile=Param.InputTable{1,3}; % the first sorted RootFile taken for output
    16481648    set(handles.OutputDirExt,'String',Param.OutputDirExt)
    1649     OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]);% full name (with path) of output directory
     1649    OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory
    16501650    if check_create    % create output directory if it does not exist
    16511651        [tild,msg1]=mkdir(OutputDir);
    16521652        if ~strcmp(msg1,'')
    1653             errormsg=['cannot create ' OutputDir ': ' msg1];%error message for directory creation
     1653            errormsg=['cannot create ' OutputDir ': ' msg1]; % error message for directory creation
    16541654            return
    16551655        end
     
    16631663    [~,msg1]=mkdir(DirXml);
    16641664    if ~strcmp(msg1,'')
    1665         errormsg=['cannot create ' DirXml ': ' msg1];%error message for directory creation
     1665        errormsg=['cannot create ' DirXml ': ' msg1]; % error message for directory creation
    16661666        return
    16671667    end
    16681668end
    1669 OutputNomType=nomtype2pair(Param.InputTable{1,4});% nomenclature for output files
     1669OutputNomType=nomtype2pair(Param.InputTable{1,4}); % nomenclature for output files
    16701670
    16711671%% get the set of reference input field indices
    1672 first_i=1;% first i index to process
    1673 last_i=1;% last i index to process
    1674 incr_i=1;% increment step in i index
    1675 first_j=1;% first j index to process
    1676 last_j=1;% last j index to process
    1677 incr_j=1;% increment step in j index
     1672first_i=1; % first i index to process
     1673last_i=1; % last i index to process
     1674incr_i=1; % increment step in i index
     1675first_j=1; % first j index to process
     1676last_j=1; % last j index to process
     1677incr_j=1; % increment step in j index
    16781678if isfield(Param.IndexRange,'first_i')
    16791679    first_i=Param.IndexRange.first_i;
     
    17201720    end
    17211721end
    1722 CPUTime=1;% job time estimated at 1 min per iteration (on index i and j) by default
     1722CPUTime=1; % job time estimated at 1 min per iteration (on index i and j) by default
    17231723if isfield(Param.Action, 'CPUTime') && ~isempty(Param.Action.CPUTime)
    1724     CPUTime=Param.Action.CPUTime;%Note: CpUTime for one iteration ref_i has to be multiplied by the number of j indices nbfield_j
     1724    CPUTime=Param.Action.CPUTime; % Note: CpUTime for one iteration ref_i has to be multiplied by the number of j indices nbfield_j
    17251725end
    17261726nbfield_j=numel(ref_j); % number of j indices
    1727 BlockLength=numel(ref_i);% by default, job involves the full set of i field indices
     1727BlockLength=numel(ref_i); % by default, job involves the full set of i field indices
    17281728NbProcess=1;
    17291729switch RunMode
    17301730    case {'cluster_oar','cluster_pbs','cluster_sge','cluster_qstat_unknown'}
    17311731        if isempty(Param.IndexRange.NbSlice)% if NbSlice is not defined
    1732             BlockLength= ceil(20/(CPUTime*nbfield_j));% short iterations are grouped such that the minimum time of a process is 20 min.
    1733             BlockLength=max(BlockLength,ceil(numel(ref_i)/500));% possibly increase the BlockLength to have less than 500 jobs
     1732            BlockLength= ceil(20/(CPUTime*nbfield_j)); % short iterations are grouped such that the minimum time of a process is 20 min.
     1733            BlockLength=max(BlockLength,ceil(numel(ref_i)/500)); % possibly increase the BlockLength to have less than 500 jobs
    17341734            NbProcess=ceil(numel(ref_i)/BlockLength) ; % nbre of processes sent to oar
    17351735        else
    1736             NbProcess=Param.IndexRange.NbSlice;% the parameter NbSlice sets the nbre of run processes
    1737             NbCore=min(NbCore,NbProcess);% reduces the number of cores if it exceeds the number of processes
     1736            NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes
     1737            NbCore=min(NbCore,NbProcess); % reduces the number of cores if it exceeds the number of processes
    17381738        end
    17391739    otherwise
    17401740        if ~isempty(Param.IndexRange.NbSlice)
    1741             NbProcess=Param.IndexRange.NbSlice;% the parameter NbSlice sets the nbre of run processes
     1741            NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes
    17421742        end
    17431743end
     
    17721772
    17731773%% direct processing on the current Matlab session or creation of command files
    1774 filexml=cell(1,NbProcess);% initialisation of the names of the files containing the processing parameters
     1774filexml=cell(1,NbProcess); % initialisation of the names of the files containing the processing parameters
    17751775extxml=cell(1,NbProcess); % initialisation of the set of labels used for the files documenting each process
    17761776for iprocess=1:NbProcess
     
    17851785        Param.IndexRange.first_i=first_i+(iprocess-1)*BlockLength*incr_i;
    17861786        if Param.IndexRange.first_i>last_i
    1787             NbProcess=iprocess-1;% leave the loop, we are at the end of the calculation
     1787            NbProcess=iprocess-1; % leave the loop, we are at the end of the calculation
    17881788            break
    17891789        end
     
    17941794    end
    17951795    for ilist=1:size(Param.InputTable,1)
    1796         Param.InputTable{ilist,1}=regexprep(Param.InputTable{ilist,1},'\','/');%correct path name for PCWIN system
     1796        Param.InputTable{ilist,1}=regexprep(Param.InputTable{ilist,1},'\','/'); % correct path name for PCWIN system
    17971797    end
    17981798   
     
    18041804        filexml{iprocess}=fullfile(OutputDir,'0_XML',extxml{iprocess});
    18051805        try
    1806             save(t, filexml{iprocess});% save the xml file containing the processing parameters
     1806            save(t, filexml{iprocess}); % save the xml file containing the processing parameters
    18071807        catch ME
    18081808            if ~strcmp (RunMode,'local')
     
    18151815        switch ActionExt
    18161816            case '.m'
    1817                 h_fun(Param);% direct launching
     1817                h_fun(Param); % direct launching
    18181818               
    18191819            case '.sh'
    18201820                switch computer
    18211821                    case {'PCWIN','PCWIN64'} %Windows system
    1822                         filexml=regexprep(filexml,'\\','\\\\');% add '\' so that '\' are left as characters
    1823                         system([ActionFullName ' ' RunTime ' ' filexml{iprocess}]);% TODO: adapt to DOS system
     1822                        filexml=regexprep(filexml,'\\','\\\\'); % add '\' so that '\' are left as characters
     1823                        system([ActionFullName ' ' RunTime ' ' filexml{iprocess}]); % TODO: adapt to DOS system
    18241824                    case {'GLNX86','GLNXA64','MACI64'}%Linux  system
    18251825                        system([ActionFullName ' ' RunTime ' ' filexml{iprocess}]);
     
    18311831if ~strcmp (RunMode,'local') && ~strcmp(RunMode,'python')
    18321832    %% processing on a different session of the same computer (background) or cluster, create executable files
    1833     batch_file_list=cell(NbProcess,1);% initiate the list of executable files
    1834     DirExe=fullfile(OutputDir,'0_EXE');%directory name for executable files
     1833    batch_file_list=cell(NbProcess,1); % initiate the list of executable files
     1834    DirExe=fullfile(OutputDir,'0_EXE'); % directory name for executable files
    18351835    switch computer
    18361836        case {'PCWIN','PCWIN64'} %Windows system
     
    18431843        [tild,msg1]=mkdir(DirExe);
    18441844        if ~strcmp(msg1,'')
    1845             errormsg=['cannot create ' DirExe ': ' msg1];%error message for directory creation
     1845            errormsg=['cannot create ' DirExe ': ' msg1]; % error message for directory creation
    18461846            return
    18471847        end
     
    18521852        [tild,msg1]=mkdir(DirLog);
    18531853        if ~strcmp(msg1,'')
    1854             errormsg=['cannot create ' DirLog ': ' msg1];%error message for directory creation
     1854            errormsg=['cannot create ' DirLog ': ' msg1]; % error message for directory creation
    18551855            return
    18561856        end
     
    19041904                        end
    19051905                        cmd=[cmd  'exit \n' 'END_MATLAB \n'];
    1906                         fprintf(fid,cmd);%fill the executable file with the  char string cmd
    1907                         fclose(fid);% close the executable file
    1908                         system(['chmod +x ' file_exe_global]);% set the file to executable
     1906                        fprintf(fid,cmd); % fill the executable file with the  char string cmd
     1907                        fclose(fid); % close the executable file
     1908                        system(['chmod +x ' file_exe_global]); % set the file to executable
    19091909                    case {'PCWIN','PCWIN64'}
    19101910                        cmd=['matlab -automation -logfile ' regexprep(filelog{iprocess},'\\','\\\\')...
     
    19151915                        end
    19161916                        cmd=[cmd ';exit"'];
    1917                         fprintf(fid,cmd);%fill the executable file with the  char string cmd
    1918                         fclose(fid);% close the executable file
     1917                        fprintf(fid,cmd); % fill the executable file with the  char string cmd
     1918                        fclose(fid); % close the executable file
    19191919                end
    19201920                system([file_exe_global ' &'])% directly execute the command file
     
    19231923                    switch computer
    19241924                        case {'GLNX86','GLNXA64','MACI64'}
    1925                             [fid,message]=fopen(batch_file_list{iprocess},'w');% create the executable file
     1925                            [fid,message]=fopen(batch_file_list{iprocess},'w'); % create the executable file
    19261926                            if isequal(fid,-1)
    19271927                                errormsg=['creation of .bat file: ' message];
     
    19321932                                'hostname && date \n '...
    19331933                                'umask 002 \n'...
    1934                                 ActionFullName ' ' RunTime ' ' filexml{iprocess}];%allow writting access to created files for user group
    1935                             fprintf(fid,cmd);%fill the executable file with the  char string cmd
    1936                             fclose(fid);% close the executable file
    1937                             system(['chmod +x ' batch_file_list{iprocess}]);% set the file to executable
     1934                                ActionFullName ' ' RunTime ' ' filexml{iprocess}]; % allow writting access to created files for user group
     1935                            fprintf(fid,cmd); % fill the executable file with the  char string cmd
     1936                            fclose(fid); % close the executable file
     1937                            system(['chmod +x ' batch_file_list{iprocess}]); % set the file to executable
    19381938                            system([batch_file_list{iprocess} ' &'])% directly execute the command file
    19391939                        case {'PCWIN','PCWIN64'}
     
    19481948        %create subdirectory for oar commands
    19491949        for iprocess=1:NbProcess
    1950             [fid,message]=fopen(batch_file_list{iprocess},'w');% create the executable file
     1950            [fid,message]=fopen(batch_file_list{iprocess},'w'); % create the executable file
    19511951            if isequal(fid,-1)
    19521952                errormsg=['creation of .bat file: ' message];
     
    19581958                    'hostname && date \n '...
    19591959                    'umask 002 \n'...
    1960                     ActionFullName ' ' RunTime ' ' filexml{iprocess}];%allow writting access to created files for user group
     1960                    ActionFullName ' ' RunTime ' ' filexml{iprocess}]; % allow writting access to created files for user group
    19611961            else
    19621962                matlab_ver = ver('MATLAB');
     
    19731973                    'END_MATLAB \n'];
    19741974            end
    1975             fprintf(fid,cmd);%fill the executable file with the  char string cmd
    1976             fclose(fid);% close the executable file
    1977             system(['chmod +x ' batch_file_list{iprocess}]);% set the file to executable
     1975            fprintf(fid,cmd); % fill the executable file with the  char string cmd
     1976            fclose(fid); % close the executable file
     1977            system(['chmod +x ' batch_file_list{iprocess}]); % set the file to executable
    19781978        end
    19791979        DirOAR=fullfile(OutputDir,'0_OAR');
     
    19861986            [tild,msg1]=mkdir(DirOAR);
    19871987            if ~strcmp(msg1,'')
    1988                 errormsg=['cannot create ' DirOAR ': ' msg1];%error message for directory creation
     1988                errormsg=['cannot create ' DirOAR ': ' msg1]; % error message for directory creation
    19891989                return
    19901990            end
    19911991        end
    19921992        % create file containing the list of jobs
    1993         filename_joblist=fullfile(DirOAR,'job_list.txt');% name of the file containing the list of executables
    1994         fid=fopen(filename_joblist,'w');%open it for writting
     1993        filename_joblist=fullfile(DirOAR,'job_list.txt'); % name of the file containing the list of executables
     1994        fid=fopen(filename_joblist,'w'); % open it for writting
    19951995        for iprocess=1:length(batch_file_list)
    1996             fprintf(fid,[batch_file_list{iprocess} '\n']);% write list of exe files
     1996            fprintf(fid,[batch_file_list{iprocess} '\n']); % write list of exe files
    19971997        end
    19981998        fclose(fid);
    1999         system(['chmod +x ' filename_joblist]);% set the file to executable
     1999        system(['chmod +x ' filename_joblist]); % set the file to executable
    20002000       
    2001         filename_log=fullfile(DirLog,'job_list.stdout');%file for output messages of the master oar process
    2002         filename_errors=fullfile(DirLog,'job_list.stderr');%file for error messages of the master oar process
     2001        filename_log=fullfile(DirLog,'job_list.stdout'); % file for output messages of the master oar process
     2002        filename_errors=fullfile(DirLog,'job_list.stderr'); % file for error messages of the master oar process
    20032003        % the command job_list.txt contains the list of NbProcess independent individual jobs
    20042004        % in which the total calculation has been split. Those are written as executable files .sh in the folder /O_EXE.
     
    20082008        % shorter than the wall time: in the time interval 'checkpoint' (WallTimeOneJob) before the end of the allowed duration,
    20092009        %  the oar job restarts when an individual job ends.
    2010         JobTime=CPUTime*BlockLength*nbfield_j;% estimated time for one individual job (in minutes)
     2010        JobTime=CPUTime*BlockLength*nbfield_j; % estimated time for one individual job (in minutes)
    20112011        % wall time (in hours ) for each oar job, allowing 10 individual jobs, but limited to 23 h:
    20122012        WallTimeTotal=min(23,4*JobTime/60);
    20132013        %disp(['WallTimeTotal: ' num2str(WallTimeTotal) ' hours'])
    20142014        % estimated time of an individual job (in min), with a margin of error
    2015         WallTimeOneJob=min(4*JobTime+10,WallTimeTotal*60/2);% estimated max time of an individual job for checkpoint
     2015        WallTimeOneJob=min(4*JobTime+10,WallTimeTotal*60/2); % estimated max time of an individual job for checkpoint
    20162016        disp(['WallTimeOneJob: ' num2str(WallTimeOneJob) ' minutes'])
    20172017        oar_command=['oarsub -n UVmat_' ActionFullName ' '...
     
    20262026            '-l ' filename_joblist '.log"'];
    20272027       
    2028         fprintf(oar_command);% display  system command on the Matlab command window
     2028        fprintf(oar_command); % display  system command on the Matlab command window
    20292029        [status,result]=system(oar_command)% execute system command and show the result (ID number of the launched job) on the Matlab command window
    2030         filename_oarcommand=fullfile(DirOAR,'0_oar_command');% keep track of the command in file '0-OAR/0_oar_command'
     2030        filename_oarcommand=fullfile(DirOAR,'0_oar_command'); % keep track of the command in file '0-OAR/0_oar_command'
    20312031        fid=fopen(filename_oarcommand,'w');
    20322032        fprintf(fid,oar_command); % store the command
    2033         fprintf(fid,result);% store the result (job ID number)
     2033        fprintf(fid,result); % store the result (job ID number)
    20342034        fclose(fid);
    20352035        msgbox_uvmat('CONFIRMATION',[ActionFullName ' launched as  ' num2str(NbProcess) ' processes in cluster: press STATUS to see results'])
     
    20372037    case 'cluster_pbs' % for LMFA Kepler machine
    20382038        %create subdirectory for pbs command and log files
    2039         DirPBS=fullfile(OutputDir,'0_PBS'); %todo : common name OAR/PBS
     2039        DirPBS=fullfile(OutputDir,'0_PBS'); % todo : common name OAR/PBS
    20402040        if exist(DirPBS,'dir')% delete the content of the dir 0_LOG to allow new input
    20412041            curdir=pwd;
     
    20462046            [tild,msg1]=mkdir(DirPBS);
    20472047            if ~strcmp(msg1,'')
    2048                 errormsg=['cannot create ' DirPBS ': ' msg1];%error message for directory creation
     2048                errormsg=['cannot create ' DirPBS ': ' msg1]; % error message for directory creation
    20492049                return
    20502050            end
     
    20522052        max_walltime=3600*20; % 20h max total calculation (cannot exceed 24 h)
    20532053        walltime_onejob=1800; % seconds, max estimated time for asingle file index value
    2054         filename_joblist=fullfile(DirPBS,'job_list.txt');%create name of the global executable file
     2054        filename_joblist=fullfile(DirPBS,'job_list.txt'); % create name of the global executable file
    20552055        fid=fopen(filename_joblist,'w');
    20562056        for iprocess=1:length(batch_file_list)
    2057             fprintf(fid,[batch_file_list{iprocess} '\n']);% list of exe files
     2057            fprintf(fid,[batch_file_list{iprocess} '\n']); % list of exe files
    20582058        end
    20592059        fclose(fid);
    2060         system(['chmod +x ' filename_joblist]);% set the file to executable
     2060        system(['chmod +x ' filename_joblist]); % set the file to executable
    20612061        pbs_command=['qsub -n CIVX '...
    20622062            '-t idempotent --checkpoint ' num2str(walltime_onejob+60) ' '...
     
    20722072        fprintf(fid,pbs_command);
    20732073        fclose(fid);
    2074         fprintf(pbs_command);% display in command line
     2074        fprintf(pbs_command); % display in command line
    20752075        %system(pbs_command);
    20762076        msgbox_uvmat('CONFIRMATION',[ActionFullName ' command ready to be launched in cluster'])
     
    20902090            [tild,msg1]=mkdir(DirSGE);
    20912091            if ~strcmp(msg1,'')
    2092                 errormsg=['cannot create ' DirSGE ': ' msg1];%error message for directory creation
     2092                errormsg=['cannot create ' DirSGE ': ' msg1]; % error message for directory creation
    20932093                return
    20942094            end
     
    21222122                    '-o ' fullfile([DirSGE '/job' num2str(currJobIndex) '.out']) ' '...
    21232123                    fullfile([DirSGE '/job' num2str(currJobIndex) '.sh'])];
    2124                 fprintf(sge_command);% display in command line
     2124                fprintf(sge_command); % display in command line
    21252125                [status, result] = system(sge_command);
    21262126                fprintf(result);
     
    21442144    [SUCCESS,MESSAGE,MESSAGEID] = fileattrib (OutputDir)
    21452145    if MESSAGE.GroupWrite~=1
    2146     [success,msg] = fileattrib(OutputDir,'+w','g','s');% allow writing access for the group of users, recursively in the folder
     2146    [success,msg] = fileattrib(OutputDir,'+w','g','s'); % allow writing access for the group of users, recursively in the folder
    21472147    if success==0
    2148         msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg});%error message for directory creation
     2148        msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg}); % error message for directory creation
    21492149    end
    21502150    end
     
    21692169%% clean the output structure by removing unused information
    21702170if isfield(Param,'Pairs')
    2171     Param=rmfield(Param,'Pairs'); %info Pairs not needed for output
     2171    Param=rmfield(Param,'Pairs'); % info Pairs not needed for output
    21722172end
    21732173if isfield(Param,'InputLine')
     
    22072207
    22082208%% get Action name and path
    2209 NbBuiltinAction=get(handles.Action,'UserData'); %nbre of functions initially proposed in the menu ActionName (as defined in the Opening fct of series)
    2210 ActionList=get(handles.ActionName,'String');% list menu fields
     2209NbBuiltinAction=get(handles.Action,'UserData'); % nbre of functions initially proposed in the menu ActionName (as defined in the Opening fct of series)
     2210ActionList=get(handles.ActionName,'String'); % list menu fields
    22112211ActionIndex=get(handles.ActionName,'Value');
    22122212if ~isequal(ActionIndex,1)% if we are not just opening series
     
    22182218end
    22192219ActionName= ActionList{get(handles.ActionName,'Value')}; % selected function name
    2220 ActionPathList=get(handles.ActionName,'UserData');%list of recorded paths to functions of the list ActionName
     2220ActionPathList=get(handles.ActionName,'UserData'); % list of recorded paths to functions of the list ActionName
    22212221
    22222222%% add a new function to the menu if 'more...' has been selected in the menu ActionName
     
    22332233   
    22342234    % insert the choice in the menu ActionName
    2235     ActionIndex=find(strcmp(ActionName,ActionList),1);% look for the selected function in the menu Action
     2235    ActionIndex=find(strcmp(ActionName,ActionList),1); % look for the selected function in the menu Action
    22362236    PathName=regexprep(PathName,'/$','');
    22372237    if ~isempty(ActionIndex) && ~strcmp(ActionPathList{ActionIndex},PathName)%compare the path to the existing fct
     
    22402240    if isempty(ActionIndex)%the qselected fct (with selected path) does not exist in the menu
    22412241        ActionIndex= length(ActionList);
    2242         ActionList=[ActionList(1:end-1);{ActionName};ActionList(end)];% the selected function is appended in the menu, before the last item 'more...'
     2242        ActionList=[ActionList(1:end-1);{ActionName};ActionList(end)]; % the selected function is appended in the menu, before the last item 'more...'
    22432243         ActionPathList=[ActionPathList; PathName];
    22442244    end
     
    22522252
    22532253    % remove old Action options in the menu (keeping a menu length <nb_builtin_ACTION+5)
    2254     if length(ActionList)>NbBuiltinAction+5; %nb_builtin_ACTION=nbre of functions always remaining in the initial menu
     2254    if length(ActionList)>NbBuiltinAction+5; % nb_builtin_ACTION=nbre of functions always remaining in the initial menu
    22552255        nbremove=length(ActionList)-NbBuiltinAction-5;
    22562256        ActionList(NbBuiltinAction+1:end-5)=[];
     
    22842284
    22852285%% check the current ActionPath to the selected function
    2286 ActionPath=ActionPathList{ActionIndex};%current recorded path
    2287 set(handles.ActionPath,'String',ActionPath); %show the path to the senlected function
     2286ActionPath=ActionPathList{ActionIndex}; % current recorded path
     2287set(handles.ActionPath,'String',ActionPath); % show the path to the senlected function
    22882288
    22892289%% reinitialise the waitbar
     
    22952295    return
    22962296end
    2297 current_dir=pwd;%current working dir
     2297current_dir=pwd; % current working dir
    22982298cd(ActionPath)
    22992299h_fun=str2func(ActionName);
     
    23042304% path_series=which('series');
    23052305% %eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION
    2306 % spath=fileparts(which(ActionName)); %spath = current path of the selected function ACTION
     2306% spath=fileparts(which(ActionName)); % spath = current path of the selected function ACTION
    23072307% if ~exist(ActionPath,'dir')
    23082308%     msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
     
    23242324
    23252325%% Activate the Action fct to adapt the configuration of the GUI series and bring specific parameters in SeriesData
    2326 Param=read_GUI_series(handles);% read the parameters from the GUI series
    2327 ParamOut=h_fun(Param);%run the selected Action function to get the relevant input
     2326Param=read_GUI_series(handles); % read the parameters from the GUI series
     2327ParamOut=h_fun(Param); % run the selected Action function to get the relevant input
    23282328
    23292329%% Put the first line of the selected Action fct as tooltip help
     
    23372337
    23382338%% Visibility of VelType and VelType_1 menus asked by ActionName
    2339 VelTypeRequest=1;%VelType requested by default
    2340 VelTypeRequest_1=1;%VelType requested by default
     2339VelTypeRequest=1; % VelType requested by default
     2340VelTypeRequest_1=1; % VelType requested by default
    23412341if isfield(ParamOut,'VelType')
    23422342    VelTypeRequest=ismember(ParamOut.VelType,{'on','one','two'});
     
    23512351
    23522352%% Detect the types of input files and set menus and default options in 'VelType'
    2353 SeriesData=get(handles.series,'UserData');% info on the input file series
     2353SeriesData=get(handles.series,'UserData'); % info on the input file series
    23542354iview_civ=find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));
    2355 iview_netcdf=find(strcmp('netcdf',SeriesData.FileType)|strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));% all nc files, icluding civ
    2356 FieldList=get(handles.FieldName,'String');% previous list as default
     2355iview_netcdf=find(strcmp('netcdf',SeriesData.FileType)|strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType)); % all nc files, icluding civ
     2356FieldList=get(handles.FieldName,'String'); % previous list as default
    23572357if ~iscell(FieldList),FieldList={FieldList};end
    2358 FieldList_1=get(handles.FieldName_1,'String');% previous list as default
     2358FieldList_1=get(handles.FieldName_1,'String'); % previous list as default
    23592359if ~iscell(FieldList_1),FieldList_1={FieldList_1};end
    2360 %CheckList=0;% indicate whether FieldName has been updated
    2361 CheckList_1=1;% indicate whether FieldName_1 has been updated
     2360%CheckList=0; % indicate whether FieldName has been updated
     2361CheckList_1=1; % indicate whether FieldName_1 has been updated
    23622362handles_coord=[handles.Coord_x handles.Coord_y handles.Coord_z handles.Coord_x_title handles.Coord_y_title handles.Coord_z_title];
    23632363if VelTypeRequest && numel(iview_civ)>=1
     
    23672367    set(handles.VelType,'Visible','on')
    23682368    set(handles.VelType_title,'Visible','on')
    2369     FieldList=[set_field_list('U','V');{'C'};{'get_field...'}];%standard menu for civx data
     2369    FieldList=[set_field_list('U','V');{'C'};{'get_field...'}]; % standard menu for civx data
    23702370    %CheckList=1;
    2371     set(handles.FieldName,'Value',1); %velocity vector choice by default
     2371    set(handles.FieldName,'Value',1); % velocity vector choice by default
    23722372    if  VelTypeRequest_1 && numel(iview_civ)>=2
    23732373        menu=set_veltype_display(SeriesData.FileInfo{iview_civ(2)}.CivStage,SeriesData.FileType{iview_civ(2)});
     
    23762376        set(handles.VelType_1,'Visible','on')
    23772377        set(handles.VelType_title_1,'Visible','on')
    2378         FieldList_1=[set_field_list('U','V');{'C'};{'get_field...'}];%standard menu for civx data
     2378        FieldList_1=[set_field_list('U','V');{'C'};{'get_field...'}]; % standard menu for civx data
    23792379        CheckList_1=1;
    2380         set(handles.FieldName_1,'Value',1); %velocity vector choice by default
     2380        set(handles.FieldName_1,'Value',1); % velocity vector choice by default
    23812381    else
    23822382        set(handles.VelType_1,'Visible','off')
     
    23942394        set(handles.FieldName,'Visible','on')
    23952395        ListVarName=SeriesData.FileInfo{iview_netcdf(1)}.ListVarName;
    2396         ind_var=get(handles.FieldName,'Value');%indices of previously selected variables
     2396        ind_var=get(handles.FieldName,'Value'); % indices of previously selected variables
    23972397        for ilist=1:numel(ind_var)
    23982398            if isempty(find(strcmp(FieldList{ind_var(ilist)},ListVarName)))
    2399                 FieldList={};% previous choice not consistent with new input field
     2399                FieldList={}; % previous choice not consistent with new input field
    24002400                set(handles.FieldName,'Value',1)
    24012401                break
     
    24252425        if CheckList_1==0        % not civ input made
    24262426            ListVarName=SeriesData.FileInfo{iview_netcdf(2)}.ListVarName;
    2427             ind_var=get(handles.FieldName,'Value');%indices of previously selected variables
     2427            ind_var=get(handles.FieldName,'Value'); % indices of previously selected variables
    24282428            for ilist=1:numel(ind_var)
    24292429                if isempty(find(strcmp(FieldList{ind_var(ilist)},ListVarName)))
    2430                     FieldList_1={};% previous choice not consistent with new input field
     2430                    FieldList_1={}; % previous choice not consistent with new input field
    24312431                    set(handles.FieldName_1,'Value',1)
    24322432                    break
     
    24722472%% Check whether alphabetical sorting of input Subdir is allowed by the Action fct  (for multiples series entries)
    24732473if isfield(ParamOut,'AllowInputSort')&&isequal(ParamOut.AllowInputSort,'on')&& size(Param.InputTable,1)>1
    2474     [tild,iview]=sort(InputTable(:,2)); %subdirectories sorted in alphabetical order
     2474    [tild,iview]=sort(InputTable(:,2)); % subdirectories sorted in alphabetical order
    24752475    set(handles.InputTable,'Data',InputTable(iview,:));
    24762476    MinIndex_i=get(handles.MinIndex_i,'Data');
     
    25152515
    25162516%% enable or desable j index visibility
    2517 status_j='on';%default
     2517status_j='on'; % default
    25182518if isfield(ParamOut,'Desable_j_index')&&isequal(ParamOut.Desable_j_index,'on')
    25192519    status_j='off';
     
    25222522    status_j='off'; % no j index needed
    25232523elseif strcmp(get(handles.PairString,'Visible'),'on')
    2524     check_burst=cellfun(@isempty,regexp(get(handles.PairString,'Data'),'^j'));%=0 for burst case, 1 otherwise
     2524    check_burst=cellfun(@isempty,regexp(get(handles.PairString,'Data'),'^j')); % =0 for burst case, 1 otherwise
    25252525    if isempty(find(check_burst, 1))% if all pair string begins by j (burst)
    25262526        status_j='off'; % no j index needed for bust case
     
    25312531
    25322532%% NbSlice visibility
    2533 %NbSliceVisible='off';%default
     2533%NbSliceVisible='off'; % default
    25342534if isfield(ParamOut,'NbSlice') && (strcmp(ParamOut.NbSlice,'on')||isnumeric(ParamOut.NbSlice))
    25352535    set(handles.num_NbSlice,'Visible','on')
     
    25892589%% definition of the directory containing the output files
    25902590if  ~(isfield(SeriesData,'ActionName') && strcmp(ActionName,SeriesData.ActionName))
    2591     OutputDirExt='.series'; %default
     2591    OutputDirExt='.series'; % default
    25922592    if isfield(ParamOut,'OutputDirExt')&&~isempty(ParamOut.OutputDirExt)
    25932593        OutputDirExt=ParamOut.OutputDirExt;
     
    25962596end
    25972597OutputDirVisible='off';
    2598 OutputSubDirMode='auto';%default
     2598OutputSubDirMode='auto'; % default
    25992599SubDirOut='';
    26002600if isfield(ParamOut,'OutputSubDirMode')
     
    26022602end
    26032603switch OutputSubDirMode
    2604     case 'auto';%default
     2604    case 'auto'; % default
    26052605        OutputDirVisible='on';
    2606         SubDir=InputTable(1:end,2); %set of subdirectories
     2606        SubDir=InputTable(1:end,2); % set of subdirectories
    26072607        SubDirOut=SubDir{1};
    26082608        if numel(SubDir)>1
     
    26132613    case 'one'
    26142614        OutputDirVisible='on';
    2615         SubDirOut=InputTable{1,2}; %use the first subdir name (+OutputDirExt) as output  subdirectory
     2615        SubDirOut=InputTable{1,2}; % use the first subdir name (+OutputDirExt) as output  subdirectory
    26162616    case 'two'
    26172617        OutputDirVisible='on';   
    2618         SubDir=InputTable(1:2,2); %set of subdirectories
     2618        SubDir=InputTable(1:2,2); % set of subdirectories
    26192619        SubDirOut=SubDir{1};
    26202620        if numel(SubDir)>1
     
    26232623    case 'last'
    26242624        OutputDirVisible='on';
    2625         SubDirOut=InputTable{end,2}; %use the last subdir name (+OutputDirExt) as output  subdirectory
     2625        SubDirOut=InputTable{end,2}; % use the last subdir name (+OutputDirExt) as output  subdirectory
    26262626end
    26272627set(handles.OutputSubDir,'String',SubDirOut)
     
    26312631%set(handles.CheckOverwrite,'Visible',OutputDirVisible)
    26322632set(handles.OutputDir_title,'Visible',OutputDirVisible)
    2633 SeriesData.ActionName=ActionName;%record ActionName for next use
     2633SeriesData.ActionName=ActionName; % record ActionName for next use
    26342634
    26352635
    26362636%% visibility of the run mode (local or background or cluster)
    26372637if strcmp(OutputSubDirMode,'none')
    2638     RunModeVisible='off';% only local mode available if no output file is produced
     2638    RunModeVisible='off'; % only local mode available if no output file is produced
    26392639else
    26402640    RunModeVisible='on';
     
    26762676    SeriesData=get(handles.series,'UserData');
    26772677    % input line for which the field choice is relevant
    2678     iview=find(ismember(SeriesData.FileType,{'netcdf','civx','civdata'}));% all nc files, icluding civ
     2678    iview=find(ismember(SeriesData.FileType,{'netcdf','civx','civdata'})); % all nc files, icluding civ
    26792679    hget_field=findobj(allchild(0),'name','get_field');
    26802680    if ~isempty(hget_field)
     
    26842684    InputTable=Param.InputTable(iview,:);
    26852685    % check the existence of the first file in the series
    2686     first_j=[];last_j=[];MinIndex_j=1;MaxIndex_j=1;%default setting for index j
    2687     if isfield(Param.IndexRange,'first_j');% if index j is used     
     2686    first_j=[];last_j=[];MinIndex_j=1;MaxIndex_j=1; % default setting for index j
     2687    if isfield(Param.IndexRange,'first_j'); % if index j is used     
    26882688        first_j=Param.IndexRange.first_j;
    26892689        last_j=Param.IndexRange.last_j;
     
    28872887function [ind_remove]=find_pairs(dirpair,ind_i,last_i)
    28882888indsel=ind_i;
    2889 indiff=diff(ind_i); %test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series
    2890 indiff=[1 indiff last_i-ind_i(end)+1];%for testing gaps with the imposed bounds
     2889indiff=diff(ind_i); % test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series
     2890indiff=[1 indiff last_i-ind_i(end)+1]; % for testing gaps with the imposed bounds
    28912891if ~isempty(indiff)
    28922892    indiff2=diff(indiff);
    28932893    indiffp=[indiff2 1];
    28942894    indiffm=[1 indiff2];
    2895     ind_multi_m=find((indiff==0)&(indiffm<0))-1;%indices of first members of multiplets
    2896     ind_multi_p=find((indiff==0)&(indiffp>0));%indices of last members of multiplets
     2895    ind_multi_m=find((indiff==0)&(indiffm<0))-1; % indices of first members of multiplets
     2896    ind_multi_p=find((indiff==0)&(indiffp>0)); % indices of last members of multiplets
    28972897    %for each multiplet, select the most recent file
    28982898    ind_remove=[];
     
    29002900        ind_pairs=ind_multi_m(i):ind_multi_p(i);
    29012901        for imulti=1:length(ind_pairs)
    2902             datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date);%dates of creation
    2903         end
    2904         [datenew,indsort2]=sort(datepair); %sort the multiplet by creation date
    2905         ind_s=indsort2(1:end-1);%
    2906         ind_remove=[ind_remove ind_pairs(ind_s)];%remove these indices, leave the last one
     2902            datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date); % dates of creation
     2903        end
     2904        [datenew,indsort2]=sort(datepair); % sort the multiplet by creation date
     2905        ind_s=indsort2(1:end-1); %
     2906        ind_remove=[ind_remove ind_pairs(ind_s)]; % remove these indices, leave the last one
    29072907    end
    29082908end
     
    29122912function [num_i1,num_i2,num_j1,num_j2,num_i_out,num_j_out]=find_file_indices(num_i,num_j,ind_shift,NomType,mode)
    29132913%------------------------------------------------------------------------
    2914 num_i1=num_i;% set of first image numbers by default
     2914num_i1=num_i; % set of first image numbers by default
    29152915num_i2=num_i;
    29162916num_j1=num_j;
     
    29202920% if isequal (NomType,'_1-2_1') || isequal (NomType,'_1-2')
    29212921if isequal(mode,'series(Di)')
    2922     num_i1_line=num_i+ind_shift(3);% set of first image numbers
     2922    num_i1_line=num_i+ind_shift(3); % set of first image numbers
    29232923    num_i2_line=num_i+ind_shift(4);
    29242924    % adjust the first and last field number
     
    29362936        num_j2=ind_shift(2)*ones(size(num_i));
    29372937    else
    2938         num_j1_col=num_j+ind_shift(1);% set of first image numbers
     2938        num_j1_col=num_j+ind_shift(1); % set of first image numbers
    29392939        num_j2_col=num_j+ind_shift(2);
    29402940        % adjust the first field number
     
    29522952function CheckObject_Callback(hObject, eventdata, handles)
    29532953%------------------------------------------------------------------------
    2954 hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle
     2954hset_object=findobj(allchild(0),'tag','set_object'); % find the set_object interface handle
    29552955if get(handles.CheckObject,'Value')
    29562956    SeriesData=get(handles.series,'UserData');
     
    29832983                data.ProjMode='none';
    29842984            end
    2985             hset_object=set_object(data);% call the set_object interface
     2985            hset_object=set_object(data); % call the set_object interface
    29862986            set(hset_object,'Name','set_object_series')% name to distinguish from set_object used with uvmat
    29872987        end
    29882988        ProjObject=read_GUI(hset_object);
    2989         set(handles.ProjObject,'String',ProjObject.Name);%display the object name
     2989        set(handles.ProjObject,'String',ProjObject.Name); % display the object name
    29902990        SeriesData=get(handles.series,'UserData');
    29912991        SeriesData.ProjObject=ProjObject;
     
    30633063    InputTable=get(handles.InputTable,'Data');
    30643064    nbview=size(InputTable,1);
    3065     MaskTable=cell(nbview,1);%default
    3066     ListMask=cell(nbview,1);%default
     3065    MaskTable=cell(nbview,1); % default
     3066    ListMask=cell(nbview,1); % default
    30673067    MaskData=get(handles.MaskTable,'Data');
    3068     MaskData(size(MaskData,1):nbview,1)=cell(size(MaskData,1):nbview,1);%complement if undefined lines
     3068    MaskData(size(MaskData,1):nbview,1)=cell(size(MaskData,1):nbview,1); % complement if undefined lines
    30693069    for iview=1:nbview
    30703070        ListMask{iview,1}=num2str(iview);
     
    30733073            if isempty(MaskData{iview})
    30743074                SubDir=InputTable{iview,2};
    3075                 MaskPath=fullfile(RootPath,[regexprep(SubDir,'\..*','') '.mask']);%take the root part of SubDir, before the first dot '.'
     3075                MaskPath=fullfile(RootPath,[regexprep(SubDir,'\..*','') '.mask']); % take the root part of SubDir, before the first dot '.'
    30763076                if exist(MaskPath,'dir')
    3077                     ListStruct=dir(MaskPath);%look for a mask file
    3078                     ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
    3079                     check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files
    3080                     ListFiles=ListCells(1,:);%list of file and dri names
    3081                     ListFiles=ListFiles(~check_dir);%list of file names (excluding dir)
     3077                    ListStruct=dir(MaskPath); % look for a mask file
     3078                    ListCells=struct2cell(ListStruct); % transform dir struct to a cell arrray
     3079                    check_dir=cell2mat(ListCells(4,:)); % =1 for directories, =0 for files
     3080                    ListFiles=ListCells(1,:); % list of file and dri names
     3081                    ListFiles=ListFiles(~check_dir); % list of file names (excluding dir)
    30823082                    mdetect=0;
    30833083                    if ~isempty(ListFiles)
     
    30893089                            end
    30903090                            if ~strcmp(MaskFile{ifile},MaskFile{1})
    3091                                 mdetect=0;% cancel detection test in case of multiple masks, use the brower for selection
     3091                                mdetect=0; % cancel detection test in case of multiple masks, use the brower for selection
    30923092                                break
    30933093                            end
     
    31483148
    31493149
    3150 % path_to_uvmat=which ('uvmat');% check the path of uvmat
     3150% path_to_uvmat=which ('uvmat'); % check the path of uvmat
    31513151% pathelp=fileparts(path_to_uvmat);
    31523152% helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
     
    31713171        return     %browser closed without choice
    31723172    end
    3173     [TransformPath,TransformName,TransformExt]=fileparts(FileName);% removes extension .m
     3173    [TransformPath,TransformName,TransformExt]=fileparts(FileName); % removes extension .m
    31743174    if ~strcmp(TransformExt,'.m')
    31753175        msgbox_uvmat('ERROR','a Matlab function .m must be introduced');
     
    31773177    end
    31783178     % insert the choice in the menu
    3179     TransformIndex=find(strcmp(TransformName,TransformList),1);% look for the selected function in the menu Action
     3179    TransformIndex=find(strcmp(TransformName,TransformList),1); % look for the selected function in the menu Action
    31803180    if isempty(TransformIndex)%the input string does not exist in the menu
    31813181        TransformIndex= length(TransformList);
    3182         TransformList=[TransformList(1:end-1);{TransformName};TransformList(end)];% the selected function is appended in the menu, before the last item 'more...'
     3182        TransformList=[TransformList(1:end-1);{TransformName};TransformList(end)]; % the selected function is appended in the menu, before the last item 'more...'
    31833183        set(handles.TransformName,'String',TransformList)
    31843184        TransformPathList=[TransformPathList;{TransformPath}];
    31853185    else% the input function already exist, we update its path (possibly new)
    3186         TransformPathList{TransformIndex}=TransformPath;%
     3186        TransformPathList{TransformIndex}=TransformPath; %
    31873187        set(handles.TransformName,'Value',TransformIndex)
    31883188    end
    31893189   % save the new menu in the personal file 'uvmat_perso.mat'
    3190    dir_perso=prefdir;%personal Matalb directory
     3190   dir_perso=prefdir; % personal Matalb directory
    31913191   profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    31923192   if exist(profil_perso,'file')
     
    31973197       TransformPathListUser=TransformPathListUser';
    31983198       TransformListUser=TransformListUser';
    3199        save (profil_perso,'TransformPathListUser','TransformListUser','-append'); %store the root name for future opening of uvmat
     3199       save (profil_perso,'TransformPathListUser','TransformListUser','-append'); % store the root name for future opening of uvmat
    32003200   end
    32013201end
    32023202
    32033203%display the current function path
    3204 set(handles.TransformPath,'String',TransformPathList{TransformIndex}); %show the path to the senlected function
     3204set(handles.TransformPath,'String',TransformPathList{TransformIndex}); % show the path to the senlected function
    32053205set(handles.TransformName,'UserData',TransformPathList);
    32063206
     
    32113211        return
    32123212    end
    3213     current_dir=pwd;%current working dir
     3213    current_dir=pwd; % current working dir
    32143214    cd(TransformPathList{TransformIndex})
    32153215    transform_handle=str2func(TransformName);
    32163216    cd(current_dir)
    3217     Field.Action.RUN=0;% indicate that the transform fct is called only to get input param
    3218     DataOut=feval(transform_handle,Field,[]);% execute the transform fct to get the required conditions
     3217    Field.Action.RUN=0; % indicate that the transform fct is called only to get input param
     3218    DataOut=feval(transform_handle,Field,[]); % execute the transform fct to get the required conditions
    32193219    if isfield(DataOut,'TransformInput')%  used to add transform parameters at selection of the transform fct
    32203220        SeriesData=get(handles.series,'UserData');
     
    32343234display('current series config :')
    32353235evalin('base','Param') %display CurData in the workspace
    3236 commandwindow; %brings the Matlab command window to the front
     3236commandwindow; % brings the Matlab command window to the front
    32373237
    32383238%------------------------------------------------------------------------
     
    32443244%% use a browser to choose the xml file containing the processing config
    32453245InputTable=get(handles.InputTable,'Data');
    3246 oldfile=InputTable{1,1};%current path in InputTable
     3246oldfile=InputTable{1,1}; % current path in InputTable
    32473247if isempty(oldfile)
    32483248    % use a file name stored in prefdir
     
    32563256    end
    32573257end
    3258 filexml=uigetfile_uvmat('pick a xml parameter file',oldfile,'.xml');% get the xml file containing processing parameters
     3258filexml=uigetfile_uvmat('pick a xml parameter file',oldfile,'.xml'); % get the xml file containing processing parameters
    32593259if isempty(filexml), return, end % quit function if an xml file has not been opened
    32603260
    32613261%% fill the GUI series with the content of the xml file
    3262 Param=xml2struct(filexml);% read the input xml file as a Matlab structure
     3262Param=xml2struct(filexml); % read the input xml file as a Matlab structure
    32633263
    32643264% ask to stop current Action if button RUN is in action (another process is already running)
     
    32713271    end
    32723272end
    3273 Param.Action.RUN=0; %desactivate the input RUN=1
     3273Param.Action.RUN=0; % desactivate the input RUN=1
    32743274
    32753275fill_GUI(Param,handles.series)% fill the elements of the GUI series with the input parameters
     
    32853285    set(handles.ActionInput,'Visible','on')
    32863286    set(handles.ActionInput,'Value',0)
    3287     Param.ActionInput.ConfigSource=filexml;% record the source of config for future info
     3287    Param.ActionInput.ConfigSource=filexml; % record the source of config for future info
    32883288    SeriesData.ActionInput=Param.ActionInput;
    32893289end
     
    33073307    set(handles.DeleteObject,'Visible','off')     
    33083308end     
    3309 set(handles.REFRESH,'BackgroundColor',[1 0 1]); %paint REFRESH button in magenta to indicate that it should be activated
     3309set(handles.REFRESH,'BackgroundColor',[1 0 1]); % paint REFRESH button in magenta to indicate that it should be activated
    33103310
    33113311
     
    33693369        return
    33703370    end
    3371     OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
     3371    OutputSubDir=[Param.OutputSubDir Param.OutputDirExt]; % subdirectory for output files
    33723372    OutputDir=fullfile(RootPath,OutputSubDir);
    33733373    if exist(OutputDir,'dir')
     
    34463446    return
    34473447end
    3448 ListFiles(1)=[];%removes the first line ='.'
     3448ListFiles(1)=[]; % removes the first line ='.'
    34493449ListDisplay=cell(numel(ListFiles),1);
    34503450testrecent=0;
     
    34533453    ListDisplay{ilist}=ListFiles(ilist).name;
    34543454      if ~ListFiles(ilist).isdir && isfield(ListFiles(ilist),'datenum')
    3455             datnum(ilist)=ListFiles(ilist).datenum;%only available in recent matlab versions
     3455            datnum(ilist)=ListFiles(ilist).datenum; % only available in recent matlab versions
    34563456            testrecent=1;
    34573457       end
     
    34613461%% Look at date of creation
    34623462ListDisplay=ListDisplay(datnum~=0);
    3463 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files
     3463datnum=datnum(datnum~=0); % keep the non zero values corresponding to existing files
    34643464NbOutputFile=[];
    34653465if isempty(datnum)
     
    35633563%% create the GUI set_pairs
    35643564set(0,'Unit','points')
    3565 ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
    3566 Width=220;% fig width in points (1/72 inch)
     3565ScreenSize=get(0,'ScreenSize'); % get the size of the screen, to put the fig on the upper right
     3566Width=220; % fig width in points (1/72 inch)
    35673567Height=min(0.8*ScreenSize(4),300);
    3568 Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40
    3569 Bottom=ScreenSize(4)-Height-40; %put fig at top right
     3568Left=ScreenSize(3)- Width-40; % right edge close to the right, with margin=40
     3569Bottom=ScreenSize(4)-Height-40; % put fig at top right
    35703570hfig=findobj(allchild(0),'Tag','set_slice');
    3571 if ~isempty(hfig),delete(hfig), end; %delete existing version of the GUI
     3571if ~isempty(hfig),delete(hfig), end; % delete existing version of the GUI
    35723572hfig=figure('name','set_pairs','tag','set_pairs','MenuBar','none','NumberTitle','off','Unit','points','Position',[Left,Bottom,Width,Height]);
    35733573BackgroundColor=get(hfig,'Color');
     
    35753575TimeUnit=get(handles.TimeUnit,'String');
    35763576PairString=get(handles.PairString,'Data');
    3577 ListViewLines=find(cellfun('isempty',PairString)==0);%find list of non empty pairs
     3577ListViewLines=find(cellfun('isempty',PairString)==0); % find list of non empty pairs
    35783578ListViewMenu=cell(numel(ListViewLines),1);
    35793579iview=get(handles.PairString,'Value');
     
    35823582end
    35833583if isempty(iview)
    3584     ListViewValue=numel(ListViewLines);% we work by default on the pair option for the last line which requires pairs
     3584    ListViewValue=numel(ListViewLines); % we work by default on the pair option for the last line which requires pairs
    35853585    iview=ListViewLines(end);
    35863586else
     
    35883588end
    35893589ref_i=str2num(get(handles.num_first_i,'String'));
    3590 ref_j=1;%default
     3590ref_j=1; % default
    35913591if strcmp(get(handles.num_first_j,'String'),'Visible')
    35923592    ref_j=str2num(get(handles.num_first_j,'String'));
     
    35973597% first raw of the GUI
    35983598uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.88 0.5 0.1],'BackgroundColor',BackgroundColor,...
    3599     'String','row to edit #','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');%title
     3599    'String','row to edit #','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right'); % title
    36003600uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.54 0.8 0.3 0.2],'BackgroundColor',[1 1 1],...
    36013601    'Callback',@(hObject,eventdata)ListView_Callback(hObject,eventdata),'String',ListViewMenu,'Value',ListViewValue,'FontUnits','points','FontSize',12,'FontWeight','bold',...
     
    36033603% second raw of the GUI
    36043604uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.79 0.7 0.1],'BackgroundColor',BackgroundColor,...
    3605     'String','mode of index pairing:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left');%title
     3605    'String','mode of index pairing:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); % title
    36063606uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.05 0.62 0.9 0.2],'BackgroundColor',[1 1 1],...
    36073607    'Callback',@(hObject,eventdata)Mode_Callback(hObject,eventdata),'String',ModeMenu,'Value',ModeValue,'FontUnits','points','FontSize',12,'FontWeight','bold',...
     
    36093609% third raw
    36103610uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.6 0.7 0.1],'BackgroundColor',BackgroundColor,...
    3611     'String','pair choice:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left');%title
     3611    'String','pair choice:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); % title
    36123612uicontrol('Style','listbox','Units','normalized', 'Position', [0.05 0.42 0.9 0.2],'BackgroundColor',[1 1 1],...
    36133613    'Callback',@(hObject,eventdata)ListPair_Callback(hObject,eventdata),'String',displ_pair,'Value',1,'FontUnits','points','FontSize',12,'FontWeight','bold',...
    36143614    'Tag','ListPair','TooltipString','''ListPair'': menu for selecting the image pair');
    36153615uicontrol('Style','text','Units','normalized', 'Position', [0.1 0.22 0.8 0.1],'BackgroundColor',BackgroundColor,...
    3616     'String','ref_i           ref_j','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title
     3616    'String','ref_i           ref_j','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center'); % title
    36173617uicontrol('Style','edit','Units','normalized', 'Position', [0.15 0.17 0.3 0.08],'BackgroundColor',[1 1 1],...
    36183618    'Callback',@(hObject,eventdata)num_ref_i_Callback(hObject,eventdata),'String',num2str(ref_i),'FontUnits','points','FontSize',12,'FontWeight','bold',...
     
    36363636function Mode_Callback(hObject,eventdata)
    36373637%% get input info
    3638 hseries=findobj(allchild(0),'tag','series');%handles of the GUI series
    3639 hhseries=guidata(hseries);%handles of the elements in the GUI series
     3638hseries=findobj(allchild(0),'tag','series'); % handles of the GUI series
     3639hhseries=guidata(hseries); % handles of the elements in the GUI series
    36403640TimeUnit=get(hhseries.TimeUnit,'String');
    36413641SeriesData=get(hseries,'UserData');
     
    36503650
    36513651%% enable j index visibility after the new choice
    3652 status_j='on';%default
     3652status_j='on'; % default
    36533653if isempty(find(~cellfun(@isempty,SeriesData.j1_series), 1)); % case of empty j indices
    36543654    status_j='off'; % no j index needed
    36553655elseif strcmp(get(handles.PairString,'Visible'),'on')
    3656     check_burst=cellfun(@isempty,regexp(PairString,'^j'));%=0 for burst case, 1 otherwise
     3656    check_burst=cellfun(@isempty,regexp(PairString,'^j')); % =0 for burst case, 1 otherwise
    36573657    if isempty(find(check_burst, 1))% if all pair string begins by j (burst)
    36583658        status_j='off'; % no j index needed for bust case
     
    36853685function ListPair_Callback(hObject,eventdata)
    36863686%------------------------------------------------------------
    3687 list_pair=get(hObject,'String');%get the menu of image pairs
     3687list_pair=get(hObject,'String'); % get the menu of image pairs
    36883688if isempty(list_pair)
    36893689    string='';
    36903690else
    36913691    string=list_pair{get(hObject,'Value')};
    3692    % string=regexprep(string,',.*','');%removes time indication (after ',')
     3692   % string=regexprep(string,',.*',''); % removes time indication (after ',')
    36933693end
    36943694hseries=findobj(allchild(0),'tag','series');
     
    37253725iline=str2double(get(handles.InputLine,'String'));
    37263726if size(InputTable,1)>1
    3727     InputTable(iline,:)=[];% suppress the current line if not the first
     3727    InputTable(iline,:)=[]; % suppress the current line if not the first
    37283728    set(handles.InputTable,'Data',InputTable);
    37293729end
Note: See TracChangeset for help on using the changeset viewer.