Index: /trunk/src/series/aver_stat.m
===================================================================
--- /trunk/src/series/aver_stat.m	(revision 189)
+++ /trunk/src/series/aver_stat.m	(revision 190)
@@ -368,4 +368,5 @@
                 end
              end   
+
              % coordinate transform (or other user defined transform)
              if ~isempty(transform_fct)
@@ -422,7 +423,4 @@
                     end
                 end
-%             else
-%                 nbmissing=nbmissing+1;
-%             end
         end
     end %end averaging loop
@@ -447,12 +445,8 @@
         DataMean.Time_end=time(end,num_i1{end}(end),num_j1{end}(end));
     end
-    
+
     %writing the result file
    if testima   
-%        if NbSlice==1
         [filemean]=name_generator(filebase_out,num_i1{1}(1),num_j1{1}(1),'.png',NomTypeOut,1,num_i2{end}(end),num_j2{end}(end),subdir_result);
-%        else % label the file number by the slice # for simplicity
-%           [filemean]=name_generator(filebase_out,i_slice,1,'.png','_i');
-%        end
         if exist(filemean,'file')
             backupfile=filemean;
@@ -485,9 +479,5 @@
             DataMean.ListGlobalAttribute=[DataMean.ListGlobalAttribute {'Time','Time_end'}];
         end  
-%         if NbSlice==1
-          filemean=name_generator(filebase_out,num_i1{1}(1),num_j1{1}(1),'.nc',NomTypeOut,1,num_i2{end}(end),num_j2{end}(end),subdir_result);
-%         else % label the file number by the slice # for simplicity
-%           [filemean]=name_generator(filebase_out,i_slice,1,'.nc','_i');
-%         end
+        filemean=name_generator(filebase_out,num_i1{1}(1),num_j1{1}(1),'.nc',NomTypeOut,1,num_i2{end}(end),num_j2{end}(end),subdir_result);
         if exist(filemean,'file')
             backupfile=filemean;
Index: /trunk/src/series/check_files.m
===================================================================
--- /trunk/src/series/check_files.m	(revision 189)
+++ /trunk/src/series/check_files.m	(revision 190)
@@ -88,5 +88,5 @@
         Tabchar=message;
     else
-        datnum=[];
+        datnum=zeros(1,nbfield);
         Tabchar={};
         %LOOP ON SLICES
@@ -109,5 +109,7 @@
                     else
                         datfile=dir(file);
-                        datnum(ifile)=datenum(datfile.date);
+                        if isfield(datfile,'datenum')
+                            datnum(ifile)=datfile.datenum;
+                        end
                         filefound(ifile)={datfile.name};
                         lastfield='';
Index: /trunk/src/series/time_series.m
===================================================================
--- /trunk/src/series/time_series.m	(revision 189)
+++ /trunk/src/series/time_series.m	(revision 190)
@@ -37,5 +37,5 @@
 WaitbarPos=get(hseries.waitbar_frame,'Position'); %position of the waitbar frame
 
-%projection object
+%% projection object
 test_object=get(hseries.GetObject,'Value');
 if test_object
@@ -52,5 +52,5 @@
 end
 
-% root names
+%% root names
 if iscell(Series.RootPath)
     RootPath=Series.RootPath;
@@ -79,21 +79,6 @@
 nbfield=size(num_i1{1},1)*size(num_i1{1},2); %number of fields in the time series
 
-%Number of input series: this function  accepts only a single input file series 
+%Number of input series: this function  accepts only one or two input file series (sub_field is used in the latter case)
 nbview=length(RootPath);
-if nbview==2
-    %TODO: choose between difference and two series
-elseif nbview>2  % TODO: make multiple series
-%     RootPath=RootPath(1:2);
-%     set(hseries.RootPath,'String',RootPath)
-%     SubDir=SubDir(1:2);
-%     set(hseries.SubDir,'String',SubDir)
-%     RootFile=RootFile(1:2);
-%     set(hseries.RootFile,'String',RootFile)
-%     NomType=NomType(1:2);
-%     %set(hseries.NomType,'String',NomType)
-%     FileExt=FileExt(1:2);
-%     set(hseries.FileExt,'String',FileExt)
-%     nbview=2;
-end
 
 %determine image type
@@ -147,5 +132,4 @@
        return
     end
-    %hhget_field=guidata(hget_field);%handles of GUI elements in get_field
     SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
     if isempty(SubField)
@@ -155,36 +139,10 @@
         SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
     end
-%     if isequal(get(hhget_field.menu_coord,'Visible'),'on')
-%         list_transform=get(hhget_field.menu_coord,'String');
-%         val_list=get(hhget_field.menu_coord,'Value');
-%         transform=list_transform{val_list};
-%     end
 end
 
 %detect whether the two files are 'images' or 'netcdf'
-% testima=0;
-% testvol=0;
+
 testcivx=0;
-% testnc=0;
 FileExt=get(hseries.FileExt,'String');
-% for iview=1:nbview
-%      ext=FileExt{iview};
-%      form=imformats(ext([2:end]));
-%      if isequal(lower(ext),'.vol')
-%          testvol=testvol+1;
-%      elseif ~isempty(form)||isequal(lower(ext),'.avi')% if the extension corresponds to an image format recognized by Matlab
-%          testima=testima+1;
-%      elseif isequal(ext,'.nc')
-%          testnc=testnc+1;
-%      end
-% end
-% if testvol
-%     msgbox_uvmat('ERROR','volume images not implemented yet')
-%     return
-% end
-% if testnc~=nbview && testima~=nbview && testvol~=nbview
-%     msgbox_uvmat('need a set of images or a set of netcdf files with the same fields as input','ERROR')
-%     return
-% end
 if ~isequal(FieldName,{'get_field...'})
     testcivx=isequal(FileType{1},'netcdf');
@@ -200,5 +158,5 @@
 end
 
-%Calibration data and timing: read the ImaDoc files
+%% Calibration data and timing: read the ImaDoc files
 mode=''; %default
 timecell={};
@@ -245,5 +203,5 @@
 end
 
-%check coincidence in time
+%% check coincidence in time
 multitime=0;
 if length(timecell)==0
@@ -275,25 +233,24 @@
 end
 
-% Root name of output files (TO GENERALISE FOR TWO INPUT SERIES)
+%%  Root name of output files (TO GENERALISE FOR TWO INPUT SERIES)
 subdir_result='time_series';
-if ~exist(fullfile(RootPath{1},subdir_result),'dir')
-    dircur=pwd; %record current working directory
-    cd(RootPath{1})% goes to the iamge directory
-    [m1,m2,m3]=mkdir(subdir_result);
-    if ~isequal(m2,'')
-         msgbox_uvmat('CONFIRMATION',m2);%error message for directory creation
-    end
-    [xx,msg2] = fileattrib(subdir_result,'+w','g'); %yield writing access (+w) to user group (g)
-    if ~strcmp(msg2,'')
-        msgbox_uvmat('ERROR',['pb of permission for ' subdir_result ': ' msg2])%error message for directory creation
-        cd(dircur)
-        return
-    end
-    cd(dircur) %back to the initial working directory
-end
+pathdir=fullfile(RootPath{1},subdir_result);
+while exist(pathdir,'dir')
+    pathdir=[pathdir '.0'];
+end
+[m1,m2,m3]=mkdir(pathdir);
+if ~isequal(m2,'')
+     msgbox_uvmat('CONFIRMATION',m2);%error message for directory creation
+end
+[xx,msg2] = fileattrib(pathdir,'+w','g'); %yield writing access (+w) to user group (g)
+if ~strcmp(msg2,'')
+    msgbox_uvmat('ERROR',['pb of permission for ' subdir_result ': ' msg2])%error message for directory creation
+    return
+end
+
 filebase_out=filebase{1}; 
 NomTypeOut=nomtype2pair(NomType{1},num_i2{end}(end)-num_i1{1}(1),num_j2{end}(end)-num_j1{1}(1));
 
-% coordinate transform or other user defined transform
+%% coordinate transform or other user defined transform
 transform_fct=[];%default
 if isfield(Series,'transform_fct')
@@ -301,5 +258,5 @@
 end
 
-% to update:
+%% velocity type
 VelType_str=get(hseries.VelTypeMenu,'String');
 VelType_val=get(hseries.VelTypeMenu,'Value');
@@ -311,5 +268,5 @@
 end
 
-%LOOP ON SLICES
+%% LOOP ON SLICES
 for i_slice=1:NbSlice
      dt=[];
