Index: /trunk/src/find_file_series.m
===================================================================
--- /trunk/src/find_file_series.m	(revision 609)
+++ /trunk/src/find_file_series.m	(revision 610)
@@ -249,5 +249,5 @@
         NomType='*';
     else
-        i1_series=i1_series(:,2)*ones(0,FileInfo.NumberOfFrames);
+        i1_series=i1_series(:,2)*ones(1,FileInfo.NumberOfFrames);
         i1_series=[i1_series(:,1) i1_series];
         j1_series=ones(size(i1_series,1),1)*(0:FileInfo.NumberOfFrames);
Index: /trunk/src/read_image.m
===================================================================
--- /trunk/src/read_image.m	(revision 609)
+++ /trunk/src/read_image.m	(revision 610)
@@ -16,5 +16,5 @@
 function [A,ObjectOut]=read_image(FileName,FileType,VideoObject,num)
 %-----------------------------------------------------------------------
-if ~exist(FileType,'var')
+if ~exist('FileType','var')
     FileType='image';
 end
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 609)
+++ /trunk/src/series.m	(revision 610)
@@ -2473,23 +2473,25 @@
     OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
     OutputDir=fullfile(RootPath,OutputSubDir);
-    hfig=findobj(allchild(0),'name','series_status');
-    if isempty(hfig)
-        ScreenSize=get(0,'ScreenSize');
-        hfig=figure('DeleteFcn',@stop_status,'Position',[ScreenSize(3)-600 ScreenSize(4)-640 560 600]);
-        set(hfig,'MenuBar','none')% suppress the menu bar
-        set(hfig,'NumberTitle','off')%suppress the fig number in the title
-        set(hfig,'name','series_status')
-        set(hfig,'tag','series_status')
-        uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @view_file,'tag','list','UserData',OutputDir);
-        uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','titlebox','Max',2,'String',OutputDir);
-        uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]);
-        uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status);
-        uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI);
-        %set(hrefresh,'UserData',StatusData)
-        BarPosition=[0.05 0.81 0.01 0.05];
-        uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar');
-        drawnow
-    end
-    refresh_GUI(hfig) 
+    uigetfile_uvmat('status_display',OutputDir)
+    
+%     hfig=findobj(allchild(0),'name','series_status');
+%     if isempty(hfig)
+%         ScreenSize=get(0,'ScreenSize');
+%         hfig=figure('DeleteFcn',@stop_status,'Position',[ScreenSize(3)-600 ScreenSize(4)-640 560 600]);
+%         set(hfig,'MenuBar','none')% suppress the menu bar
+%         set(hfig,'NumberTitle','off')%suppress the fig number in the title
+%         set(hfig,'name','series_status')
+%         set(hfig,'tag','series_status')
+%         uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @view_file,'tag','list','UserData',OutputDir);
+%         uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','titlebox','Max',2,'String',OutputDir);
+%         uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]);
+%         uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status);
+%         uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI);
+%         %set(hrefresh,'UserData',StatusData)
+%         BarPosition=[0.05 0.81 0.01 0.05];
+%         uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar');
+%         drawnow
+%     end
+%     refresh_GUI(hfig) 
 else
     %% delete current display fig if selection is off
Index: /trunk/src/series/civ_series.m
===================================================================
--- /trunk/src/series/civ_series.m	(revision 609)
+++ /trunk/src/series/civ_series.m	(revision 610)
@@ -76,63 +76,91 @@
 %% input files and indexing
 NbField=1;
+MaxIndex=cell2mat(Param.IndexRange.MaxIndex);
+MinIndex=cell2mat(Param.IndexRange.MinIndex);
 if isfield(Param,'InputTable')
-    RootPath=Param.InputTable{1,1};
-    RootFile=Param.InputTable{1,3};
-    SubDir=Param.InputTable{1,2};
-    NomType=Param.InputTable{1,4};
-    FileExt=Param.InputTable{1,5};
-    PairCiv1=Param.ActionInput.PairIndices.ListPairCiv1;
-    PairCiv2='';
-    if isfield(Param.ActionInput.PairIndices,'ListPairCiv2')
-        PairCiv2=Param.ActionInput.PairIndices.ListPairCiv2;
-    end
-    MaxIndex=cell2mat(Param.IndexRange.MaxIndex);
-    MinIndex=cell2mat(Param.IndexRange.MinIndex);
     [filecell,i_series,tild,j_series]=get_file_series(Param);
-    [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{1,1});
-    if strcmp(FileType_A,'civdata')% a civdata file has been introduced as input.
-         [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{2,1});
-    end
-    [i1_series_Civ1,i2_series_Civ1,j1_series_Civ1,j2_series_Civ1,check_bounds,NomTypeNc]=...
-        find_pair_indices(PairCiv1,i_series{1},j_series{1},MinIndex,MaxIndex);
-    if ~isempty(PairCiv2)
-        [i1_series_Civ2,i2_series_Civ2,j1_series_Civ2,j2_series_Civ2,check_bounds_Civ2]=...
-            find_pair_indices(PairCiv2,i_series{1},j_series{1},MinIndex,MaxIndex);
-        check_bounds=check_bounds | check_bounds_Civ2;
-    end
-    i1_series_Civ1=i1_series_Civ1(~check_bounds);
-    i2_series_Civ1=i2_series_Civ1(~check_bounds);
-    j1_series_Civ1=j1_series_Civ1(~check_bounds);
-    j2_series_Civ1=j2_series_Civ1(~check_bounds);
-    if ~isempty(j1_series_Civ1)
-        FrameIndex_A_Civ1=j1_series_Civ1;
-        FrameIndex_B_Civ1=j2_series_Civ1;
+    if ~exist(filecell{1,1},'file')
+        displ('ERROR: the first input file does not exist')
+        return
     else
-        FrameIndex_A_Civ1=i1_series_Civ1;
-        FrameIndex_B_Civ1=i2_series_Civ1;
-    end
-    if ~isempty(PairCiv2)
-        i1_series_Civ2=i1_series_Civ2(~check_bounds);
-        i2_series_Civ2=i2_series_Civ2(~check_bounds);
-        j1_series_Civ2=j1_series_Civ2(~check_bounds);
-        j2_series_Civ2=j2_series_Civ2(~check_bounds);
-        if ~isempty(j1_series_Civ2)
-            FrameIndex_A_Civ2=j1_series_Civ2;
-            FrameIndex_B_Civ2=j2_series_Civ2;
-        else
-            FrameIndex_A_Civ2=i1_series_Civ2;
-            FrameIndex_B_Civ2=i2_series_Civ2;
-        end
-    end
-    
-    NbField=numel(i1_series_Civ1);
-
-    FileType_B=FileType_A;
-    MovieObject_B=MovieObject_A;
-    if size(filecell,1)>=2 && ~strcmp(filecell{1,1},filecell{2,1})
-        [FileType_B,FileInfo,MovieObject_B]=get_file_type(filecell{2,1});
-    end
-end
-
+        FileType=get_file_type(filecell{1,1});
+        iview_nc=0;
+        iview_A=0;
+        iview_B=0;
+        switch FileType
+            case 'civdata';% =1 for images
+                iview_nc=1;
+                if size(filecell,1)>=2
+                    iview_A=2;iview_B=2;
+                    if size(filecell,1)>=3
+                        iview_B=3;
+                    end
+                end
+            case {'image','multimage','mmreader','video'}
+                iview_A=1;
+                if size(filecell,1)>=2
+                    iview_B=2;
+                end
+        end
+    end
+    if iview_A~=0
+        [FileType_A,FileInfo_A,VideoObject_A]=get_file_type(filecell{1,1});
+        if isempty(strcmp(FileType_A,{'multimage','mmreader','video'}))
+            displ(['ERROR: the file line ' num2str(iview_A) ' must be an image'])
+        end
+        RootPath=Param.InputTable{1,1};
+        RootFile=Param.InputTable{1,3};
+        SubDir=Param.InputTable{1,2};
+        NomType=Param.InputTable{1,4};
+        FileExt=Param.InputTable{1,5};
+    end
+    if iview_B==0
+        FileType_B=FileType_A;
+VideoObject_B=VideoObject_A;
+        PairCiv1=Param.ActionInput.PairIndices.ListPairCiv1;
+        PairCiv2='';
+        if isfield(Param.ActionInput.PairIndices,'ListPairCiv2')
+            PairCiv2=Param.ActionInput.PairIndices.ListPairCiv2;
+        end
+        [i1_series_Civ1,i2_series_Civ1,j1_series_Civ1,j2_series_Civ1,check_bounds,NomTypeNc]=...
+            find_pair_indices(PairCiv1,i_series{1},j_series{1},MinIndex,MaxIndex);
+        if ~isempty(PairCiv2)
+            [i1_series_Civ2,i2_series_Civ2,j1_series_Civ2,j2_series_Civ2,check_bounds_Civ2]=...
+                find_pair_indices(PairCiv2,i_series{1},j_series{1},MinIndex,MaxIndex);
+            check_bounds=check_bounds | check_bounds_Civ2;
+        end
+        i1_series_Civ1=i1_series_Civ1(~check_bounds);
+        i2_series_Civ1=i2_series_Civ1(~check_bounds);
+        j1_series_Civ1=j1_series_Civ1(~check_bounds);
+        j2_series_Civ1=j2_series_Civ1(~check_bounds);
+        if isempty(j_series{1})
+            FrameIndex_A_Civ1=i1_series_Civ1;
+            FrameIndex_B_Civ1=i2_series_Civ1;
+        else
+            FrameIndex_A_Civ1=j1_series_Civ1;
+            FrameIndex_B_Civ1=j2_series_Civ1;
+        end
+        if ~isempty(PairCiv2)
+            i1_series_Civ2=i1_series_Civ2(~check_bounds);
+            i2_series_Civ2=i2_series_Civ2(~check_bounds);
+            j1_series_Civ2=j1_series_Civ2(~check_bounds);
+            j2_series_Civ2=j2_series_Civ2(~check_bounds);
+            if isempty(j_series{1})
+                FrameIndex_A_Civ2=i1_series_Civ2;
+                FrameIndex_B_Civ2=i2_series_Civ2;
+            else
+                FrameIndex_A_Civ2=j1_series_Civ2;
+                FrameIndex_B_Civ2=j2_series_Civ2;
+            end
+        end
+    else
+           [FileType_B,FileInfo,VideoObject_B]=get_file_type(filecell{2,1});
+        if isempty(strcmp(FileType_B,{'multimage','mmreader','video'}))
+            displ(['ERROR: the file line ' num2str(iview_B) ' must be an image'])
+        end   
+        %TODO : introduce the second file series if relevant: case %displacement
+    end
+end
+NbField=numel(i1_series_Civ1);
 
 %% Output directory
@@ -172,47 +200,17 @@
         end
 end
-if strcmp(InputTable{iview,4},'*')
-    if ~isempty(VideoObject)
-        imainfo=get(VideoObject);
-        time=zeros(imainfo.NumberOfFrames+1,2);
-        time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)';
-        TimeSource='video';
-       % set(han:dles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec
-        ColorType='truecolor';
-    elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image
-        if ~isempty(InputTable{iview,2})
-            imainfo=imfinfo(fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,5}]));
-        else
-            imainfo=imfinfo([FileBase InputTable{iview,5}]);
-        end
-        ColorType=imainfo.ColorType;%='truecolor' for color images
-        if length(imainfo) >1 %case of image with multiple frames
-            nbfield=length(imainfo);
-            nbfield_j=1;
-        end
-    end
-end
-
-%TODO: get time_A and time_B
-
-if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader'))
-    set(handles.ListPairMode,'Value',1);
-    dt=1/get(MovieObject,'FrameRate');%time interval between successive frames
-    if strcmp(NomTypeIma,'*')
-        set(handles.ListPairMode,'String',{'series(Di)'})
-        MaxIndex_i=get(MovieObject,'NumberOfFrames');
-        time=(dt*(0:MaxIndex_i-1))';%list of image times
-    else
-        set(handles.ListPairMode,'String',[{'series(Dj)'};{'series(Di)'}])
-        MaxIndex_i=max(i1_series(i1_series>0));
-        MaxIndex_j=get(MovieObject,'NumberOfFrames');
-        time=ones(MaxIndex_i,1)*(dt*(0:MaxIndex_j-1));%list of image times
-        enable_j(handles,'on')
-    end
-    TimeUnit='s';
-end
+if ~isempty(strcmp(FileType_A,{'mmreader','video'}))% case of video input
+    time=zeros(2,FileInfo_A.NumberOfFrames+1);
+    time(2,:)=(0:1/FileInfo_A.FrameRate:(FileInfo_A.NumberOfFrames)/FileInfo_A.FrameRate);
+    TimeSource='video';
+    % set(han:dles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec
+    ColorType='truecolor';
+end
+if length(FileInfo_A) >1 %case of image with multiple frames
+    nbfield=length(FileInfo_A);
+    nbfield_j=1;
+end
+
 %%%%% MAIN LOOP %%%%%%
-
-MovieObject_A=[];
 for ifield=1:NbField
     
@@ -232,12 +230,12 @@
         else
             ImageName_A=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield));
-            [par_civ1.ImageA,MovieObject_A] = read_image(ImageName_A,FileType_A,MovieObject_A,FrameIndex_A_Civ1(ifield));
+            [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ1(ifield));
             ImageName_B=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield));
-            [par_civ1.ImageB,MovieObject_B] = read_image(ImageName_B,FileType_B,MovieObject_B,FrameIndex_B_Civ1(ifield));
+            [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(ifield));
         end
         ncfile=fullfile_uvmat(RootPath,OutputDir,RootFile,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),...
             j1_series_Civ1(ifield),j2_series_Civ1(ifield));
-        par_civ1.ImageWidth=FileInfo.Width;
-        par_civ1.ImageHeight=FileInfo.Height;
+        par_civ1.ImageWidth=FileInfo_A.Width;
+        par_civ1.ImageHeight=FileInfo_A.Height;
         list_param=(fieldnames(Param.ActionInput.Civ1))';
         Civ1_param=regexprep(list_param,'^.+','Civ1_$0');% insert 'Civ1_' before  each string in list_param
@@ -246,6 +244,19 @@
         Data.Civ1_ImageA=ImageName_A;
         Data.Civ1_ImageB=ImageName_B;
-        Data.Civ1_Time=((time(i2_civ1(ifile)+1,j2_civ1(j)+1)+time(i1_civ1(ifile)+1,j1_civ1(j)+1))/2);
-        Data.Civ1_Dt=(time(i2_civ1(ifile)+1,j2_civ1(j)+1)-time(i1_civ1(ifile)+1,j1_civ1(j)+1));
+        i1=i1_series_Civ1(ifield);
+        i2=i1;
+        if ~isempty(i2_series_Civ1)
+            i2=i2_series_Civ1(ifield);
+        end
+        j1=1;
+        if ~isempty(j1_series_Civ1)
+            j1=j1_series_Civ1(ifield);
+        end
+        j2=j1;
+        if ~isempty(j2_series_Civ1)
+            j2=j2_series_Civ1(ifield);
+        end
+        Data.Civ1_Time=(time(j2+1,i2+1)+time(j1+1,i1+1))/2;
+        Data.Civ1_Dt=time(j2+1,i2+1)-time(j1+1,i1+1)
         for ilist=1:length(list_param)
             Data.(Civ1_param{4+ilist})=Param.ActionInput.Civ1.(list_param{ilist});
@@ -385,5 +396,5 @@
             par_civ2.ImageA=par_civ1.ImageA;
         else
-            [par_civ2.ImageA,MovieObject_A] = read_image(ImageName_A,FileType_A,MovieObject_A,FrameIndex_A_Civ2);
+            [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ2);
         end
         ImageName_B_Civ2=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i2_series_Civ2(ifield),[],j2_series_Civ2(ifield));
@@ -391,5 +402,5 @@
             par_civ2.ImageB=par_civ1.ImageB;
         else
-            [par_civ2.ImageB,MovieObject_B] = read_image(ImageName_B,FileType_B,MovieObject_B,FrameIndex_B_Civ2);
+            [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ2);
         end     
         
@@ -919,10 +930,10 @@
     find_pair_indices(str_civ,i_series,j_series,MinIndex,MaxIndex)
 %------------------------------------------------------------------------
-i1_series=i_series;% set of first image numbers
+i1_series=i_series;% set of first image indexes
 i2_series=i_series;
 j1_series=ones(size(i_series));% set of first image numbers
 j2_series=ones(size(i_series));
 check_bounds=false(size(i_series));
-r=regexp(str_civ,'^\D(?<ind>[i|j])= (?<num1>\d+)\|(?<num2>\d+)','names');
+r=regexp(str_civ,'^\D(?<ind>[i|j])=( -| )(?<num1>\d+)\|(?<num2>\d+)','names');
 if ~isempty(r)
     mode=['D' r.ind];
Index: /trunk/src/uigetfile_uvmat.m
===================================================================
--- /trunk/src/uigetfile_uvmat.m	(revision 609)
+++ /trunk/src/uigetfile_uvmat.m	(revision 610)
@@ -12,14 +12,23 @@
 function fileinput=uigetfile_uvmat(title,InputName)
 fileinput=''; %default file selection
-if strcmp(title,'status')
-    option='status';
+if strcmp(title,'status_display')
+    option='status_display';
 else
     option='browser';
 end
-if exist(InputName,'file')||exist(InputName,'dir')
+if exist(InputName,'dir')
+    InputDir=InputName;
+      InputFileName='';
+elseif exist(InputName,'file')
     [InputDir,InputFileName,Ext]=fileparts(InputName);
-    InputFileName=[InputFileName Ext];
+    if isempty(InputFileName)% if InputName is already the root
+        InputFileName=InputDir;
+        if  ~isempty(strcmp (computer, {'PCWIN','PCWIN64'}))%case of Windows systems
+            InputDir=[InputDir '\'];% append '\' for a correct action of dir
+            InputFileName=[InputFileName '\'];
+        end
+    end
     if isdir(InputName)
-        InputFileName=['+/' InputFileName];
+        InputFileName=['+/' InputFileName Ext];
     end
 else
@@ -45,5 +54,5 @@
         'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',12);
     %set(hrefresh,'UserData',StatusData)
-    if strcmp(option,'status') %put a run advancement display
+    if strcmp(option,'status_display') %put a run advancement display
         set(hfig,'DeleteFcn',@stop_status)
         uicontrol('Style','frame','Units','normalized', 'Position',[0.05 0.81 0.01 0.05],'BackgroundColor',[1 0 0],'tag','waitbar');
@@ -59,10 +68,96 @@
     drawnow
 end
-refresh_GUI(findobj(hfig,'Tag','refresh'),InputFileName)  
-if ~strcmp(option,'status')  
+refresh_GUI(findobj(hfig,'Tag','refresh'),InputFileName)% refresh the list of content of the current dir  
+if ~strcmp(option,'status_display')  
     uiwait(hfig)
-end
-fileinput=get(hfig,'UserData');% retrieve the input file selection
-delete(hfig)
+    fileinput=get(hfig,'UserData');% retrieve the input file selection
+    delete(hfig)
+end
+
+
+
+%------------------------------------------------------------------------   
+% --- launched by refreshing the display figure
+function refresh_GUI(hObject,InputFileName)
+%------------------------------------------------------------------------
+if ~exist('InputFileName','var')
+    InputFileName='';
+end
+hfig=get(hObject,'parent');
+DirName=get(hfig,'UserData');
+ListFiles=list_files(DirName);% list the directory content
+hlist=findobj(hfig,'tag','list');% find the list object
+set(hlist,'String',ListFiles)
+Value=[];
+if ~isempty(InputFileName)
+    Value=find(strcmp(InputFileName,ListFiles));
+end
+if isempty(Value)
+    Value=1;
+end
+set(hlist,'Value',Value)
+
+if strcmp(get(hfig,'Tag'),'status_display')
+    
+    hseries=findobj(allchild(0),'tag','series');
+    hstatus=findobj(hseries,'tag','status_display');
+    StatusData=get(hstatus,'UserData');
+    TimeStart=0;
+    if isfield(StatusData,'TimeStart')
+        TimeStart=StatusData.TimeStart;
+    end
+    
+    
+    htitlebox=findobj(hfig,'tag','titlebox');
+    hlist=findobj(hfig,'tag','list');
+    OutputDir=get(hfig,'UserData');
+    
+    testrecent=0;
+    datnum=zeros(numel(ListDisplay),1);
+    for ilist=1:numel(ListDisplay)
+        ListDisplay{ilist}=ListFiles(ilist).name;
+        if ListFiles(ilist).isdir
+            ListDisplay{ilist}=['/' ListDisplay{ilist}];
+        elseif isfield(ListFiles(ilist),'datenum')
+            datnum(ilist)=ListFiles(ilist).datenum;%only available in recent matlab versions
+            testrecent=1;
+            if datnum(ilist)<TimeStart
+                ListDisplay{ilist}=[ListDisplay{ilist} '  --OLD--'];
+            end
+        end
+    end
+    
+    %% Look at date of creation
+    ListDisplay=ListDisplay(datnum~=0);
+    datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files
+    
+    NbOutputFile=[];
+    if isempty(datnum)
+        if testrecent
+            message='no result created yet';
+        else
+            message='';
+        end
+    else
+        [first,indfirst]=min(datnum);
+        [last,indlast]=max(datnum);
+        NbOutputFile_str='?';
+        if isfield(StatusData,'NbOutputFile')
+            NbOutputFile=StatusData.NbOutputFile;
+            NbOutputFile_str=num2str(NbOutputFile);
+        end
+        message={[num2str(numel(datnum)) ' file(s) done over ' NbOutputFile_str] ;['oldest modification:  ' ListDisplay{indfirst} ' : ' datestr(first)];...
+            ['latest modification:  ' ListDisplay{indlast} ' : ' datestr(last)]};
+    end
+    set(htitlebox,'String', [DirName{1};message])
+    
+    %% update the waitbar
+    hwaitbar=findobj(hfig,'tag','waitbar');
+    if ~isempty(NbOutputFile)
+        BarPosition=get(hwaitbar,'Position');
+        BarPosition(3)=0.9*numel(datnum)/NbOutputFile;
+        set(hwaitbar,'Position',BarPosition)
+    end
+end
 
 %------------------------------------------------------------------------   
@@ -118,116 +213,9 @@
         set(hfig,'UserData',FullSelectName);
         uiresume(hfig)
-            case 'status'
+            case 'status_display'
            uvmat(FullSelectName);
         end
         set(gcbo,'Value',1)
     end
-end
-
-%------------------------------------------------------------------------   
-% --- launched by selecting home
-function home_dir(hObject,event)
-%------------------------------------------------------------------------
-DirName=pwd;
-ListFiles=list_files(DirName);% list the directory content
-hfig=get(hObject,'parent');
-    set(hfig,'UserData',DirName)% record the new dir name
-    htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name  
-    set(htitlebox,'String',DirName)
-    hlist=findobj(hfig,'tag','list');% find the list object
-set(hlist,'String',ListFiles)
-%------------------------------------------------------------------------
-
-%------------------------------------------------------------------------   
-% --- launched by pressing the backward (<--) button
-function backward(hObject,event)
-%------------------------------------------------------------------------
-PrevDir=get(hObject,'UserData');
-if ~isempty(PrevDir)
-hfig=get(hObject,'parent');
-set(hfig,'UserData',PrevDir)
-htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name
-set(htitlebox,'String',PrevDir)
-refresh_GUI(findobj(hfig,'Tag','refresh'))
-end
-
-%------------------------------------------------------------------------
-
-%------------------------------------------------------------------------   
-% --- launched by refreshing the display figure
-function refresh_GUI(hObject,InputFileName)
-%------------------------------------------------------------------------
-if ~exist('InputFileName','var')
-    InputFileName='';
-end
-hfig=get(hObject,'parent');
-DirName=get(hfig,'UserData');
-ListFiles=list_files(DirName);% list the directory content
-hlist=findobj(hfig,'tag','list');% find the list object
-set(hlist,'String',ListFiles)
-Value=[];
-if ~isempty(InputFileName)
-    Value=find(strcmp(InputFileName,ListFiles));
-end
-if isempty(Value)
-    Value=1;
-end
-set(hlist,'Value',Value)
-return
-
-%TODO adapt to series status
-hseries=findobj(allchild(0),'tag','series');
-hstatus=findobj(hseries,'tag','status');
-StatusData=get(hstatus,'UserData');
-TimeStart=0;
-if isfield(StatusData,'TimeStart')
-    TimeStart=StatusData.TimeStart;
-end
-% testrecent=0;
-% datnum=zeros(numel(ListDisplay),1);
-% for ilist=1:numel(ListDisplay)
-%     ListDisplay{ilist}=ListFiles(ilist).name;
-%     if ListFiles(ilist).isdir
-%         ListDisplay{ilist}=['/' ListDisplay{ilist}];    
-%     elseif isfield(ListFiles(ilist),'datenum')
-%         datnum(ilist)=ListFiles(ilist).datenum;%only available in recent matlab versions
-%         testrecent=1;
-%         if datnum(ilist)<TimeStart
-%             ListDisplay{ilist}=[ListDisplay{ilist} '  --OLD--'];
-%         end
-%     end
-% end
-
-
-%% Look at date of creation
-ListDisplay=ListDisplay(datnum~=0);
-datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files
-
-NbOutputFile=[];
-if isempty(datnum)
-    if testrecent
-        message='no result created yet';
-    else
-        message='';
-    end
-else
-    [first,indfirst]=min(datnum);
-    [last,indlast]=max(datnum);
-    NbOutputFile_str='?';
-    if isfield(StatusData,'NbOutputFile')
-        NbOutputFile=StatusData.NbOutputFile;
-        NbOutputFile_str=num2str(NbOutputFile);
-    end
-    message={[num2str(numel(datnum)) ' file(s) done over ' NbOutputFile_str] ;['oldest modification:  ' ListDisplay{indfirst} ' : ' datestr(first)];...
-        ['latest modification:  ' ListDisplay{indlast} ' : ' datestr(last)]};
-end
-set(htitlebox,'String', [DirName{1};message])
-
-%% update the waitbar
-hwaitbar=findobj(hfig,'tag','waitbar');
-if ~isempty(NbOutputFile) 
-    BarPosition=get(hwaitbar,'Position');
-    BarPosition(3)=0.9*numel(datnum)/NbOutputFile;
-    set(hwaitbar,'Position',BarPosition)
 end
 
@@ -236,5 +224,5 @@
 function ListFiles=list_files(DirName)
 %-------------------------------------------------------------------------
-ListStruct=dir(DirName);
+ListStruct=dir(DirName);% get structure of the current directory
 if numel(ListStruct)<1
     ListFiles={};
@@ -254,11 +242,38 @@
 ListFiles=[{'+/..'} ListFiles(check_keep)];
 
+%------------------------------------------------------------------------   
+% --- launched by selecting home
+function home_dir(hObject,event)
+%------------------------------------------------------------------------
+DirName=pwd;
+ListFiles=list_files(DirName);% list the directory content
+hfig=get(hObject,'parent');
+    set(hfig,'UserData',DirName)% record the new dir name
+    htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name  
+    set(htitlebox,'String',DirName)
+    hlist=findobj(hfig,'tag','list');% find the list object
+set(hlist,'String',ListFiles)
+%------------------------------------------------------------------------
+
+%------------------------------------------------------------------------   
+% --- launched by pressing the backward (<--) button
+function backward(hObject,event)
+%------------------------------------------------------------------------
+PrevDir=get(hObject,'UserData');
+if ~isempty(PrevDir)
+hfig=get(hObject,'parent');
+set(hfig,'UserData',PrevDir)
+htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name
+set(htitlebox,'String',PrevDir)
+refresh_GUI(findobj(hfig,'Tag','refresh'))
+end
+
 %-------------------------------------------------------------------------   
 % launched by deleting the status figure (only used in mode series status')
 function close(option,hObject, eventdata)
 %-------------------------------------------------------------------------
-if strcmp(option,'status')
+if strcmp(option,'status_display')
     hseries=findobj(allchild(0),'tag','series');
-    hstatus=findobj(hfig,'Tag','status');
+    hstatus=findobj(hfig,'Tag','status_display');
     set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ
     set(hhciv.status,'BackgroundColor',[0 1 0])
