Index: /trunk/src/get_field.m
===================================================================
--- /trunk/src/get_field.m	(revision 1083)
+++ /trunk/src/get_field.m	(revision 1084)
@@ -414,8 +414,12 @@
         set(handles.PanelVectors,'Visible','off')
         set(handles.Coord_y,'Visible','on')
+        set(handles.Coord_y,'Max',2)%allow multiple selection
         set(handles.Y_title,'Visible','on')
         set(handles.Coord_z,'Visible','off')
         set(handles.Z_title,'Visible','off')
-        %ordinate_Callback(hObject, VarName, handles)       
+        set(handles.Coord_x,'String',Field.Display.ListVarName')
+        Coord_x_Callback(hObject, VarName, handles) 
+        %set(handles.Coord_y,'String',Field.Display.ListVarName')
+        %Coord_x_Callback(hObject, VarName, handles)       
     case {'scalar'}
         set(handles.Coordinates,'Visible','on')
@@ -502,91 +506,95 @@
 end
 
-%NOT USED : TO DELETE------------------------------------------------------------------------
-function ordinate_Callback(hObject, DimCell, handles)
+
+function set_coord_y_options(handles,VarName)
 %------------------------------------------------------------------------
 Field=get(handles.get_field,'UserData');
-y_index=get(handles.ordinate,'Value');
-y_menu=get(handles.ordinate,'String');
-if isempty(y_menu)
-    return
-else
-YName=y_menu{y_index};
-end
+VarIndex=find(strcmp(VarName,Field.Display.ListVarName),1);
+DimCell=Field.Display.VarDimName{VarIndex};
+% y_index=get(handles.Coord_y,'Value');
+% y_menu=get(handles.Coord_y,'String');
+% if isempty(y_menu)
+%     return
+% else
+% YName=y_menu{y_index};
+% end
 
 %% set list of possible coordinates
-test_component=zeros(size(Field.Display.VarDimName));%=1 when variable #ilist is eligible as unstructured coordinate
+% test_component=zeros(size(Field.Display.VarDimName));%=1 when variable #ilist is eligible as unstructured coordinate
 test_coord=zeros(size(Field.Display.VarDimName)); %=1 when variable #ilist is eligible as structured coordiante
-ListCoord={''};
-dim_var=Field.Display.VarDimName{y_index};%list of dimensions of the selected variable
+% ListCoord={''};
+% dim_var=Field.Display.VarDimName{y_index};%list of dimensions of the selected variable
 
 for ilist=1:numel(Field.Display.VarDimName)
     dimnames=Field.Display.VarDimName{ilist}; %list of dimensions for variable #ilist
-    if isequal(dimnames,dim_var)
-        test_component(ilist)=1;
-    elseif numel(dimnames)==1 && ~isempty(find(strcmp(dimnames{1},dim_var)))%variable ilist is a 1D array which can be coordinate variable
+    if isequal(dimnames,DimCell)||isequal(dimnames(1:end-1),DimCell)||isequal(dimnames(2:end),DimCell)
         test_coord(ilist)=1;
     end
 end
-var_component=find(test_component);% list of variable indices elligible as unstructured coordinates
-var_coord=find(test_coord);% % list of variable indices elligible as structured coordinates
-ListCoord=Field.Display.ListVarName([var_component var_coord]);
+ListCoord=Field.Display.ListVarName(find(test_coord));
+set(handles.Coord_y,'String',ListCoord)
+val_y=1;
+if strcmp(VarName,ListCoord{1})&& numel(ListCoord)>=2
+    val_y=2;
+end
+set(handles.Coord_y,'Value',val_y)
 
 %% set default coord selection
-if numel(find(test_coord))>3
-     SwitchVarIndexTime=get(handles.SwitchVarIndexTime,'String');
-    if numel(SwitchVarIndexTime)<3
-        SwitchVarIndexTime=[SwitchVarIndexTime;'matrix_index'];
-        set(handles.SwitchVarIndexTime,'String',SwitchVarIndexTime)
-    end
-    set(handles.SwitchVarIndexTime,'Value',3)% the last dim must be considered as time
-    SwitchVarIndexTime_Callback([], [], handles)
-end
-if numel(var_component)<2
-    if numel(test_coord)<2
-        ListCoord={''};
-    else
-        set(handles.Coord_x,'Value',2)
-        set(handles.Coord_y,'Value',1)
-    end
-else
-    coord_val=1;
-    for ilist=1:numel(var_component)
-        ivar=var_component(ilist);
-        if isfield(Field.Display,'VarAttribute') && numel(Field.Display.VarAttribute)>=ivar && isfield(Field.Display.VarAttribute{ivar},'Role')
-            Role=Field.Display.VarAttribute{ivar}.Role;
-            if strcmp(Role,'coord_x')
-                coord_val=ilist;
-            end
-        end
-    end
-    set(handles.Coord_x,'Value',coord_val+1)
-end
-set(handles.Coord_x,'String',[{''}; ListCoord])
-
-
-%% set list of time coordinates
-menu=get(handles.SwitchVarIndexTime,'String');
-TimeOption=menu{get(handles.SwitchVarIndexTime,'Value')};
-switch TimeOption
-    case 'variable'
-        if numel(find(test_coord))<3
-            ListTime={''};
-        else
-            ListTime=Field.Display.ListVarName(find(test_coord,end));
-        end
-        set(handles.TimeName,'Value',1)
-        set(handles.TimeName,'String',ListTime)
-    case 'matrix index'
-        if numel(find(test_coord))<3
-            ListTime={''};
-        else
-            ListTime=Field.Display.VarDimName{find(test_coord,end)};
-        end
-        set(handles.TimeName,'Value',1)
-        set(handles.TimeName,'String',ListTime)
-end  
-if ~ischar(DimCell)
-update_field(handles,YName)
-end
+% if numel(find(test_coord))>3
+%      SwitchVarIndexTime=get(handles.SwitchVarIndexTime,'String');
+%     if numel(SwitchVarIndexTime)<3
+%         SwitchVarIndexTime=[SwitchVarIndexTime;'matrix_index'];
+%         set(handles.SwitchVarIndexTime,'String',SwitchVarIndexTime)
+%     end
+%     set(handles.SwitchVarIndexTime,'Value',3)% the last dim must be considered as time
+%     SwitchVarIndexTime_Callback([], [], handles)
+% end
+% if numel(var_component)<2
+%     if numel(test_coord)<2
+%         ListCoord={''};
+%     else
+%         set(handles.Coord_x,'Value',2)
+%         set(handles.Coord_y,'Value',1)
+%     end
+% else
+%     coord_val=1;
+%     for ilist=1:numel(var_component)
+%         ivar=var_component(ilist);
+%         if isfield(Field.Display,'VarAttribute') && numel(Field.Display.VarAttribute)>=ivar && isfield(Field.Display.VarAttribute{ivar},'Role')
+%             Role=Field.Display.VarAttribute{ivar}.Role;
+%             if strcmp(Role,'coord_x')
+%                 coord_val=ilist;
+%             end
+%         end
+%     end
+%     set(handles.Coord_x,'Value',coord_val+1)
+% end
+% set(handles.Coord_x,'String',[{''}; ListCoord])
+
+
+% %% set list of time coordinates
+% menu=get(handles.SwitchVarIndexTime,'String');
+% TimeOption=menu{get(handles.SwitchVarIndexTime,'Value')};
+% switch TimeOption
+%     case 'variable'
+%         if numel(find(test_coord))<3
+%             ListTime={''};
+%         else
+%             ListTime=Field.Display.ListVarName(find(test_coord,end));
+%         end
+%         set(handles.TimeName,'Value',1)
+%         set(handles.TimeName,'String',ListTime)
+%     case 'matrix index'
+%         if numel(find(test_coord))<3
+%             ListTime={''};
+%         else
+%             ListTime=Field.Display.VarDimName{find(test_coord,end)};
+%         end
+%         set(handles.TimeName,'Value',1)
+%         set(handles.TimeName,'String',ListTime)
+% end  
+% if ~ischar(DimCell)
+% update_field(handles,YName)
+% end
          
 %------------------------------------------------------------------------
@@ -672,5 +680,5 @@
 set(handles.Coord_y,'Value',coord_val(2))
 set(handles.Coord_y,'String',ListCoord)
-if numel(coord_val)>=3
+if numel(find(coord_val))>=3
     set(handles.Coord_z,'Value',coord_val(3))
     set(handles.Coord_z,'String',ListCoord)
@@ -873,11 +881,15 @@
 %------------------------------------------------------------------------
 function Coord_x_Callback(hObject, DimCell, handles)
-
+DimCell
 index=get(handles.Coord_x,'Value');
 string=get(handles.Coord_x,'String');
 VarName=string{index};
 if ~ischar(DimCell)
-update_field(handles,VarName)
-end
+    update_field(handles,VarName)
+end
+if isequal(get(handles.FieldOption,'Value'),1)
+set_coord_y_options(handles,VarName)
+end
+
 %------------------------------------------------------------------------
 % --- Executes on selection change in Coord_y.
@@ -964,4 +976,5 @@
 
 %-----------------------------------------------------------------------
+% update the display of the variable 'VarName' and its dimensions in the list of variables
 function update_field(handles,VarName)
 %-----------------------------------------------------------------------
Index: /trunk/src/proj_field.m
===================================================================
--- /trunk/src/proj_field.m	(revision 1083)
+++ /trunk/src/proj_field.m	(revision 1084)
@@ -1623,12 +1623,12 @@
                     [X,Y]=meshgrid(Coord{2},Coord{1});%initial coordinates
                     %name of error flag variable
-                    FFName='FF';%default name (if not already used)
-                    if isfield(ProjData,'FF')
-                        ind=1;
-                        while isfield(ProjData,['FF_' num2str(ind)])
-                            ind=ind+1;
-                        end
-                        FFName=['FF_' num2str(ind)];% append an index to the name of error flag, FF_1,FF_2...
-                    end
+%                     FFName='FF';%default name (if not already used)
+%                     if isfield(ProjData,'FF')
+%                         ind=1;
+%                         while isfield(ProjData,['FF_' num2str(ind)])
+%                             ind=ind+1;
+%                         end
+%                         FFName=['FF_' num2str(ind)];% append an index to the name of error flag, FF_1,FF_2...
+%                     end
                     % project all variables in the cell
                     for ivar=VarIndex
@@ -1653,11 +1653,11 @@
                             VarAttribute{length(ListVarName)+nbcoord}=FieldData.VarAttribute{ivar};
                         end
-                        ProjData.(FFName)=isnan(ProjData.(VarName));%detact NaN (points outside the interpolation range)
-                        ProjData.(VarName)(ProjData.(FFName))=0; %set to 0 the NaN data
+%                         ProjData.(FFName)=isnan(ProjData.(VarName));%detact NaN (points outside the interpolation range)
+%                         ProjData.(VarName)(ProjData.(FFName))=0; %set to 0 the NaN data
                     end
                     %update list of variables with error flag
-                    ListVarName=[ListVarName FFName];
-                    VarDimName=[VarDimName {DimCell}];
-                    VarAttribute{numel(ListVarName)}.Role='errorflag';
+%                     ListVarName=[ListVarName FFName];
+%                     VarDimName=[VarDimName {DimCell}];
+%                     VarAttribute{numel(ListVarName)}.Role='errorflag';
                 elseif ~testangle % 3Dcase without change of angle
                     % unstructured z coordinate
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 1083)
+++ /trunk/src/series.m	(revision 1084)
@@ -3328,5 +3328,5 @@
     DataOut=feval(transform_handle,Field,ParamIn);% execute the transform fct to get the required conditions
     Field.Action.RUN=0; % indicate that the transform fct is called only to get input param
-    DataOut=feval(transform_handle,Field,[]); % execute the transform fct to get the required conditions
+    %DataOut=feval(transform_handle,Field,[]); % execute the transform fct to get the required conditions
     if isfield(DataOut,'TransformInput')%  used to add transform parameters at selection of the transform fct
         SeriesData.TransformInput=DataOut.TransformInput;
Index: /trunk/src/series/merge_proj.m
===================================================================
--- /trunk/src/series/merge_proj.m	(revision 1083)
+++ /trunk/src/series/merge_proj.m	(revision 1084)
@@ -289,5 +289,5 @@
         [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},ParamIn{iview},frame_index{iview}(index));
         if isempty(errormsg)
-            disp([filecell{iview,index} ' read'])
+            disp([filecell{iview,index} ' read OK'])
         else
             disp_uvmat('ERROR',['ERROR in merge_proj/read_field/' errormsg],checkrun)
Index: /trunk/src/transform_field/phys_polar.m
===================================================================
--- /trunk/src/transform_field/phys_polar.m	(revision 1083)
+++ /trunk/src/transform_field/phys_polar.m	(revision 1084)
@@ -49,8 +49,8 @@
 %% request input parameters
 if isfield(DataIn,'Action') && isfield(DataIn.Action,'RUN') && isequal(DataIn.Action.RUN,0)
-    prompt = {'origin [x y] of polar coordinates';'reference radius';'reference angle(degrees)'};
+    prompt = {'origin [x y] of polar coordinates';'reference radius';'reference angle(degrees)';'angle direction and switch x y(+/-)'};
     dlg_title = 'set the parameters for the polar coordinates';
     num_lines= 2;
-    def     = { '[0 0]';'0';'0'};
+    def     = { '[0 0]';'0';'0';'+'};
     if isfield(XmlData,'TransformInput')
         if isfield(XmlData.TransformInput,'PolarCentre')
@@ -62,4 +62,7 @@
         if isfield(XmlData.TransformInput,'PolarReferenceAngle')
             def{3}=num2str(XmlData.TransformInput.PolarReferenceAngle);
+        end
+        if isfield(XmlData.TransformInput,'PolarAngleDirection')
+            def{4}=XmlData.TransformInput.PolarAngleDirection;
         end
     end
@@ -68,7 +71,5 @@
     Data.TransformInput.PolarReferenceRadius=str2num(answer{2}); 
     Data.TransformInput.PolarReferenceAngle=str2num(answer{3}); 
-%     if isfield(XmlData,'GeometryCalib')&& isfield(XmlData.GeometryCalib,'CoordUnit')
-%         Data.CoordUnit=XmlData.GeometryCalib.CoordUnit;% states that the output is in unit defined by GeometryCalib, then erased all projection objects with different units
-%     end
+    Data.TransformInput.PolarAngleDirection=answer{4};
     return
 end
@@ -136,10 +137,10 @@
         angle_offset=(pi/180)*XmlData.TransformInput.PolarReferenceAngle; %offset angle (in unit of the final angle, degrees or arc length along the reference radius))
     end
+    check_reverse=isfield(XmlData.TransformInput,'PolarAngleDirection')&& strcmp(XmlData.TransformInput.PolarAngleDirection,'-');
 end
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% get fields
-check_scalar=0;
-check_vector=0;
+
 nbvar=0;%counter for the number of output variables
 nbcoord=0;%counter for the number of variables for radial coordiantes (case of multiple field inputs)
@@ -163,4 +164,6 @@
         ZIndex=0;
     end
+    check_scalar=zeros(1,numel(CellInfo));
+    check_vector=zeros(1,numel(CellInfo));
     for icell=1:numel(CellInfo)
         if NbDim(icell)==2
@@ -252,6 +255,11 @@
                     Data.VarDimName=[Data.VarDimName {radius_name} {theta_name}];
                     nbvar=nbvar+2;
+                    if check_reverse
+                                            Data.VarAttribute{nbvar-1}.Role='coord_y';
+                    Data.VarAttribute{nbvar}.Role='coord_x';
+                    else
                     Data.VarAttribute{nbvar-1}.Role='coord_x';
                     Data.VarAttribute{nbvar}.Role='coord_y';
+                    end
                     check_unit=1;
                     if isfield(DataCell{ifield},'CoordUnit')
@@ -315,20 +323,35 @@
     [A,Data.radius,Data.theta]=phys_Ima_polar(A,coord_x,coord_y,Calib_new,ZInd,origin_xy,radius_offset,angle_offset,angle_scale);
     for icell=1:numel(A)
-        if icell<=numel(A)-1 && check_vector(icell)==1 && check_vector(icell+1)==1   %transform u,v into polar coordiantes
+        if icell<=numel(A)-1 && check_vector(icell)==1 && check_vector(icell+1)==1   %transform u,v into polar coordinates
             theta=Data.theta/angle_scale-angle_offset;
             [~,Theta]=meshgrid(Data.radius,theta);%grid in physical coordinates
             U_r_name= rename_indexing(U_r_name,Data.ListVarName);
-            U_theta_name= rename_indexing(U_theta_name,Data.ListVarName);
-            Data.ListVarName=[Data.ListVarName {U_r_name,U_theta_name}];
-            Data.VarDimName=[Data.VarDimName {{theta_name,radius_name}} {{theta_name,radius_name}}];
-            Data.(U_r_name)=A{icell}.*cos(Theta)+A{icell+1}.*sin(Theta);%radial velocity
-            Data.(U_theta_name)=(-A{icell}.*sin(Theta)+A{icell+1}.*cos(Theta));%./(Data.X)%+radius_ref);% azimuthal velocity component
+            U_theta_name= rename_indexing(U_theta_name,Data.ListVarName);       
+                Data.(U_r_name)=A{icell}.*cos(Theta)+A{icell+1}.*sin(Theta);%radial velocity
+                Data.(U_theta_name)=(-A{icell}.*sin(Theta)+A{icell+1}.*cos(Theta));% azimuthal velocity component
+            if check_reverse
+                Data.(U_theta_name)=(Data.(U_theta_name))';
+                Data.(U_r_name)=Data.(U_r_name)';
+                Data.ListVarName=[Data.ListVarName {U_theta_name,U_r_name}];
+                Data.VarDimName=[Data.VarDimName {{radius_name,theta_name}} {{radius_name,theta_name}}];
+            else
+                Data.ListVarName=[Data.ListVarName {U_r_name,U_theta_name}];
+                Data.VarDimName=[Data.VarDimName {{theta_name,radius_name}} {{theta_name,radius_name}}];
+            end
         elseif ~check_vector(icell)% for scalar fields
             FieldName{icell}= rename_indexing(FieldName{icell},Data.ListVarName);
-            Data.ListVarName=[Data.ListVarName {FieldName{icell}}];
-            Data.VarDimName=[Data.VarDimName {{theta_name,radius_name}}];
-            Data.(FieldName{icell})=A{icell};
-        end
-    end
+            Data.ListVarName=[Data.ListVarName FieldName(icell)];       
+            if check_reverse
+                Data.(FieldName{icell})=A{icell}';
+                Data.VarDimName=[Data.VarDimName {{radius_name,theta_name}}];
+            else
+                Data.VarDimName=[Data.VarDimName {{theta_name,radius_name}}];
+                Data.(FieldName{icell})=A{icell};
+            end
+        end
+    end
+end
+if check_reverse
+    Data.(theta_name)=-Data.(theta_name);
 end
 
@@ -406,4 +429,5 @@
 radius=Min_r:Dr:Max_r;% polar coordinates for projections
 theta=Min_theta:Dtheta:Max_theta;
+%theta=Max_theta:-Dtheta:Min_theta;
 [Radius,Theta]=meshgrid(radius,theta/angle_scale);%grid in polar coordinates (angles in radians)
 %transform X, Y in cartesian
@@ -436,7 +460,8 @@
     Dy=(coord_y{icell}(end)-coord_y{icell}(1))/(npy(icell)-1);
     indx_ima=1+round((XIMA-coord_x{icell}(1))/Dx);%indices of the initial matrix close to the points of the new grid
-    indy_ima=1+round((YIMA-coord_y{icell}(1))/Dy);
-    Delta_x=1+(XIMA-coord_x{icell}(1))/Dx-indx_ima;%
-    Delta_y=1+(YIMA-coord_y{icell}(1))/Dy-indy_ima;
+    %indy_ima=1+round((YIMA-coord_y{icell}(1))/Dy);
+    indy_ima=1+round((coord_y{icell}(end)-YIMA)/Dy);
+     Delta_x=1+(XIMA-coord_x{icell}(1))/Dx-indx_ima;%error in the index discretisation
+     Delta_y=1+(coord_y{icell}(end)-YIMA)/Dy-indy_ima;
     XIMA=reshape(indx_ima,1,[]);%indices reorganized in 'line'
     YIMA=reshape(indy_ima,1,[]);%indices reorganized in 'line'
@@ -450,10 +475,10 @@
         ind_in=find(flagin);
         ind_out=find(~flagin);
-        ICOMB=((XIMA-1)*npy(icell)+(npy(icell)+1-YIMA));
+        ICOMB=((XIMA-1)*npy(icell)+(npy(icell)+1-YIMA));% indices in vec_A
         ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A
         vec_B(ind_in)=vec_A(ICOMB);
         vec_B(ind_out)=zeros(size(ind_out));
         A_out{icell}=reshape(vec_B,np_theta,np_r);%new image in real coordinates
-        DA_y=circshift(A_out{icell},-1,1)-A_out{icell};
+        DA_y=circshift(A_out{icell},-1,1)-A_out{icell};% derivative
         DA_y(end,:)=0;
         DA_x=circshift(A_out{icell},-1,2)-A_out{icell};
Index: /trunk/src/uigetfile_uvmat.m
===================================================================
--- /trunk/src/uigetfile_uvmat.m	(revision 1083)
+++ /trunk/src/uigetfile_uvmat.m	(revision 1084)
@@ -93,5 +93,5 @@
     uicontrol('Style','pushbutton','Tag','refresh','Units','normalized','Position', [0.36 0.77 0.2 0.05],'Callback',@refresh_GUI,...
         'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',12);
-    uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.75 0.74 0.23 0.05],'tag','sort_option','Callback',@refresh_GUI,'Visible','off',...
+    uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.75 0.74 0.23 0.05],'tag','sort_option','Callback',@refresh_GUI,'Visible','on',...
         'String',{'sort name';'sort date'},'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''sort_option'': sort the files by names or dates');
     uicontrol('Style','listbox','Units','normalized', 'Position',[0.02 0.08 0.96 0.66], 'Callback', @(src,event)list_Callback(option,FilterExt,src,event),'tag','list',...
@@ -102,11 +102,8 @@
     close_button=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.78 0.005 0.2 0.07],'Callback',@(src,event)close(option,src,event),...
         'FontWeight','bold','FontUnits','points','FontSize',12);
-    %set(hrefresh,'UserData',StatusData)
     if strcmp(option,'status_display') %put a run advancement display
         set(hfig,'DeleteFcn',@(src,event)close(option,src,event))
         uicontrol('Style','frame','Units','normalized', 'Position', [0.02 0.85 0.9 0.04]);
         uicontrol('Style','frame','Units','normalized', 'Position',[0.02 0.85 0.01 0.04],'BackgroundColor',[1 0 0],'tag','waitbar');
-        %             uicontrol('Style','text','Units','normalized', 'Position', [0.4 0.8 0.35 0.03],'BackgroundColor',BackgroundColor,...
-        %             'String','sort: ','FontUnits','points','FontSize',12,'FontWeight','bold','HorizontalAlignment','right');
         delete(home_button)
         set(OK_button,'String','Open')
@@ -198,5 +195,5 @@
 set(hObject,'backgroundColor',[0 1 0])% indicate end button activatio
 fig_struct=get(hObject,'parent');
-if isstruct(fig_struct);%recent Matlab
+if isstruct(fig_struct)%recent Matlab
 uiresume(fig_struct.Number)
 else
@@ -337,4 +334,5 @@
 %-------------------------------------------------------------------------
 ListStruct=dir_uvmat(DirName);% get structure of the current directory
+date_index=find(strcmp('datenum',fieldnames(ListStruct)));% find the index of the date displayin the list of fields
 NumFiles=0; %default
 if numel(ListStruct)<1  % case of empty dir
@@ -363,7 +361,7 @@
     check_dir=check_dir(check_keep);
 end
-check_emptydate=cellfun('isempty',ListCells(5,:));% = 1 if datenum undefined 
-ListCells(5,find(check_emptydate))={0}; %set to 0 the empty dates
-ListDates=cell2mat(ListCells(5,:));%list of numerical dates
+check_emptydate=cellfun('isempty',ListCells(date_index,:));% = 1 if datenum undefined 
+ListCells(date_index,find(check_emptydate))={0}; %set to 0 the empty dates
+ListDates=cell2mat(ListCells(date_index,:));%list of numerical dates
 if isnumeric(sort_option)
     check_old=ListDates<sort_option-1;% -1 is put to account for a 1 s delay in the record of starting time
@@ -384,5 +382,5 @@
 ListFiles=[{'+/..'} ListFiles(check_keep)];
 if check_date
-    ListDateString=ListCells(2,:);%list of file dates
+    ListDateString=ListCells(3,:);%list of file dates
     if isnumeric(sort_option)
         ListDateString(check_old)={'--OLD--'};
