Index: /trunk/src/get_file_series.m
===================================================================
--- /trunk/src/get_file_series.m	(revision 449)
+++ /trunk/src/get_file_series.m	(revision 450)
@@ -35,4 +35,7 @@
     r.mode='';
     if isfield (Param.IndexRange,'PairString')
+        if ischar(Param.IndexRange.PairString)
+            Param.IndexRange.PairString={Param.IndexRange.PairString};
+        end
         r=regexp(Param.IndexRange.PairString{iview,1},'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names');
         if isempty(r)
Index: /trunk/src/read_field.m
===================================================================
--- /trunk/src/read_field.m	(revision 449)
+++ /trunk/src/read_field.m	(revision 450)
@@ -2,5 +2,5 @@
 %'read_field': read input fields in different formats
 %--------------------------------------------------------------------------
-%  function [Field,ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn)
+%  function [Field,ParamOut,errormsg] = read_field(FileName,FileType,ParamIn,num)
 %
 % OUTPUT:
@@ -23,10 +23,10 @@
 %     = video: movie read with VideoReader (recent versions of Matlab)
 %     = vol: images representing scanned volume (images concatened in the y direction)
-% ParamIn: Matlab structure of input parameters
+% ParamIn: movie object or Matlab structure of input parameters
 %     .FieldName: name (char string) of the input field (for Civx data)
 %     .VelType: char string giving the type of velocity data ('civ1', 'filter1', 'civ2'...)
 %     .ColorVar: variable used for vector color
 %     .Npx, .Npy: nbre of pixels along x and y (used for .vol input files)
-function [Field,ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn,num)
+function [Field,ParamOut,errormsg] = read_field(FileName,FileType,ParamIn,num)
 Field=[];
 if ~exist('num','var')
@@ -57,5 +57,5 @@
                 field_index=strcmp(ParamIn.FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data
                 if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist
-                    Data=nc2struct(ObjectName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage');
+                    Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage');
                     % case of new civdata conventions
                     if isequal(Data.Conventions,'uvmat/civdata')
@@ -63,5 +63,5 @@
                         ParamOut.ColorVar='ima_cor';
                         InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];
-                        [Field,ParamOut.VelType,errormsg]=read_civdata(ObjectName,InputField,ParamIn.VelType,Data.CivStage);
+                        [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType,Data.CivStage);
                         CivStage=Field.CivStage;
                         ParamOut.CivStage=Field.CivStage;
@@ -71,5 +71,5 @@
                         ParamOut.ColorVar='ima_cor';
                         InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];
-                        [Field,ParamOut.VelType]=read_civxdata(ObjectName,InputField,ParamIn.VelType);
+                        [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType);
                         CivStage=Field.CivStage;
                         ParamOut.CivStage=Field.CivStage;
@@ -88,5 +88,5 @@
                         InputField=[InputField {ParamOut.ColorVar}];
                     end
-                    [Field,ParamOut.VelType,errormsg]=read_civxdata(ObjectName,InputField,ParamIn.VelType);
+                    [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType);
                     if ~isempty(errormsg)
                         return
@@ -100,10 +100,10 @@
                 hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI
                 if isempty(hget_field)% open the GUI get_field if it is not found
-                    hget_field= get_field(ObjectName);%open the get_field GUI
+                    hget_field= get_field(FileName);%open the get_field GUI
                     set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1)
                 end
                 hhget_field=guidata(hget_field);
                 %% update  the get_field GUI
-                set(hhget_field.inputfile,'String',ObjectName)
+                set(hhget_field.inputfile,'String',FileName)
                 set(hhget_field.list_fig,'Value',1)
                 if exist('num','var')&&~isnan(num)
@@ -116,5 +116,5 @@
                 Tabchar={''};%default
                 Tabcell=[];
-                set(hhget_field.inputfile,'String',ObjectName)
+                set(hhget_field.inputfile,'String',FileName)
                 if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute)
                     for iline=1:length(Field.ListGlobalAttribute)
@@ -145,7 +145,7 @@
             end
         case {'video','mmreader'}
-            A=read(ObjectName,num);
+            A=read(ParamIn,num);
         case 'vol'
-            A=imread(ObjectName);
+            A=imread(FileName);
             Npz=size(A,1)/ParamIn.Npy;
             A=reshape(A',ParamIn.Npx,ParamIn.Npy,Npz);
@@ -153,7 +153,7 @@
         case 'multimage'
             warning 'off'
-            A=imread(ObjectName,num);
+            A=imread(FileName,num);
         case 'image'
-            A=imread(ObjectName);
+            A=imread(FileName);
     end
 catch ME
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 449)
+++ /trunk/src/series.m	(revision 450)
@@ -665,14 +665,13 @@
 
 %% number of slices
+NbSlice=MaxIndex_j-MinIndex_j+1;%default
 if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord')
     siz=size(XmlData.GeometryCalib.SliceCoord);
     if siz(1)>1
         NbSlice=siz(1);
-    else
-        NbSlice=1;
-    end
-    set(handles.num_NbSlice,'String',num2str(NbSlice))
-end
-
+    end
+end
+set(handles.num_NbSlice,'String',num2str(NbSlice))
+   
 %% update pair menus
 set(handles.Pairs,'Visible','on')
@@ -1417,4 +1416,5 @@
     end
     detect=exist(fullfile(Series.InputTable{1,1},SubDirOutNew),'dir');% test if  the dir  already exist
+    check_create=1; %need to create the result directory by default
     while detect
         answer=msgbox_uvmat('INPUT_Y-N',['use existing ouput directory: ' fullfile(Series.InputTable{1,1},SubDirOutNew) ', possibly delete previous data']);
@@ -1438,5 +1438,9 @@
     Series.OutputRootFile=Series.InputTable{1,3};% the first sorted RootFile taken for output
     set(handles.OutputDirExt,'String',Series.OutputDirExt)
-    Series=rmfield(Series,'OutputDirExt');%removes redondant information
+    %removes redondant information
+    Series=rmfield(Series,'OutputDirExt');
+    Series.IndexRange=rmfield(Series.IndexRange,'TimeTable');
+    Series.IndexRange=rmfield(Series.IndexRange,'MinIndex');
+    Series.IndexRange=rmfield(Series.IndexRange,'MaxIndex');
     % create output directory 
     if check_create
@@ -1449,4 +1453,5 @@
     filexml=fullfile(Series.OutputDir,[Series.InputTable{1,3} '.xml']);% name of the parameter xml file set in this directory
     t=struct2xml(Series);
+    t=set(t,1,'name','Series');
     save(t,filexml);
 end
Index: /trunk/src/struct2xml.m
===================================================================
--- /trunk/src/struct2xml.m	(revision 449)
+++ /trunk/src/struct2xml.m	(revision 450)
@@ -24,5 +24,5 @@
 fieldnames=fields(Object);
 for ilist=1:length(fieldnames)
-   eval(['val=Object.' fieldnames{ilist} ';'])
+   val=Object.(fieldnames{ilist});
    if isstruct(val)
       [t,uid]=add(t,root_uid,'element',fieldnames{ilist});
@@ -60,3 +60,16 @@
            end
        end
+ elseif iscell(val)
+      siz=size(val);
+      if length(siz)<=2 %do not translate cell matrices with more than 2 indices
+          separator='   '; %mark the separation of columns
+          for iline=1:siz(1)
+                val_str=cell2mat(cell2tab(val(iline,:),' & ')); % produce a line string with column separator ' & '
+                [t,new_uid]=add(t,uid,'element',key);
+                if siz(1)>1
+                    t = attributes(t,'add',new_uid,'i',num2str(iline));
+                end
+                [t]=add(t,new_uid,'chardata',val_str);
+          end
+      end
  end   
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 449)
+++ /trunk/src/uvmat.m	(revision 450)
@@ -41,10 +41,10 @@
 %     - Information defined from the interface:
 %           .NewSeries: =1 when the first view of a new field series is displayed, else 0
-%           .filename:(char string)
+%           .FileName:(char string)
 %           .FieldName: (char string) main field selected('image', 'velocity'...)
 %           .CName: (char string)name of the scalar used for vector colors
 %          .MovieObject{1}: movie object representing an input movie
 %          .MovieObject{2}: idem for a second input series (_1)
-%          .filename_1 : last second input file name (to deal with a constant second input without reading again the file)
+%          .FileName_1 : last second input file name (to deal with a constant second input without reading again the file)
 %          .ZMin, .ZMax: range of the z coordinate
 %..... to complement
@@ -787,6 +787,4 @@
             else
                 msgbox_uvmat('WARNING','unable to synchronise the indices of the two series')
-%                 set(handles.SubField,'Value',0)
-%                 SubField_Callback([], [], handles)
             end
         end
@@ -846,5 +844,4 @@
 UvData.j1_series{index}=j1_series;
 UvData.j2_series{index}=j2_series;
-% set(handles.CheckFixPair,'Value',1) % activate by default the comp_input '-'input window
 set(handles.FixVelType,'Value',0); %desactivate fixed veltype
 if index==1
@@ -924,5 +921,6 @@
     [XmlData,warntext]=imadoc2struct(filexml);
     if ~isempty(warntext)
-        msgbox_uvmat('WARNING',warntext)
+        display(warntext)
+%         msgbox_uvmat('WARNING',warntext)
     end
     if isfield(XmlData,'TimeUnit')
@@ -1968,5 +1966,5 @@
 % Field: structure describing an optional input field (then replace the input file)
 
-function errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,Field)
+function errormsg=refresh_field(handles,FileName,FileName_1,num_i1,num_i2,num_j1,num_j2,Field)
 %------------------------------------------------------------------------
 
@@ -1985,6 +1983,6 @@
 %% determine the main input file information for action
 FileType=[];%default
-if ~exist(filename,'file')
-    errormsg=['input file ' filename ' does not exist'];
+if ~exist(FileName,'file')
+    errormsg=['input file ' FileName ' does not exist'];
     return
 end
@@ -2010,6 +2008,5 @@
 ParamIn.ColorVar='';%default variable name for vector color
 frame_index=1;%default
-if ~isempty(filename)
-    ObjectName=filename;
+if ~isempty(FileName)
     FieldName='';%default
     VelType='';%default
@@ -2036,5 +2033,5 @@
             end
         case {'video','mmreader'}
-            ObjectName=UvData.MovieObject{1};      
+            ParamIn=UvData.MovieObject{1};      
             if ~strcmp(NomType,'*')
                 frame_index=num_j1;%frame index for movies or multimage
@@ -2060,7 +2057,7 @@
     ParamIn.VelType=VelType;
     ParamIn.GUIName='get_field';
-    [Field{1},ParamOut,errormsg] = read_field(ObjectName,UvData.FileType{1},ParamIn,frame_index);
+    [Field{1},ParamOut,errormsg] = read_field(FileName,UvData.FileType{1},ParamIn,frame_index);
     if ~isempty(errormsg)
-        errormsg=['error in reading ' filename ': ' errormsg];
+        errormsg=['error in reading ' FileName ': ' errormsg];
         return
     end  
@@ -2077,15 +2074,15 @@
 end
 
-%% choose and read a second field filename_1 if defined
+%% choose and read a second field FileName_1 if defined
 VelType_1=[];%default
 FieldName_1=[];
 ParamOut_1=[];
 frame_index_1=1;
-if ~isempty(filename_1)
-    if ~exist(filename_1,'file')
-        errormsg=['second file ' filename_1 ' does not exist'];
+if ~isempty(FileName_1)
+    if ~exist(FileName_1,'file')
+        errormsg=['second file ' FileName_1 ' does not exist'];
         return
     end
-    Name=filename_1;
+    Name=FileName_1;
     switch UvData.FileType{2}
         case {'civx','civdata','netcdf'};
@@ -2108,5 +2105,5 @@
             end
         case {'video','mmreader'}
-            Name=UvData.MovieObject{2};
+            ParamIn_1=UvData.MovieObject{2};
                         if ~strcmp(NomType_1,'*')
                 frame_index_1=num_j1;%frame index for movies or multimage
@@ -2136,6 +2133,6 @@
     test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged
     if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie)
-        if isfield(UvData,'filename_1')%&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1')
-            test_keepdata_1= strcmp(filename_1,UvData.filename_1) ;%&& strcmp(FieldName_1,UvData.FieldName_1);
+        if isfield(UvData,'FileName_1')%&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1')
+            test_keepdata_1= strcmp(FileName_1,UvData.FileName_1) ;%&& strcmp(FieldName_1,UvData.FieldName_1);
         end
     end
@@ -2149,5 +2146,5 @@
         [Field{2},ParamOut_1,errormsg] = read_field(Name,UvData.FileType{2},ParamIn_1,frame_index_1);
         if ~isempty(errormsg)
-            errormsg=['error in reading ' FieldName_1 ' in ' filename_1 ': ' errormsg];
+            errormsg=['error in reading ' FieldName_1 ' in ' FileName_1 ': ' errormsg];
             return
         end
@@ -2195,5 +2192,5 @@
 %% update the display menu for the second velocity type (second menuline)
 test_veltype_1=0;
-if isempty(filename_1)
+if isempty(FileName_1)
     set(handles.Fields_1,'Value',1); %update the field menu
     set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu
@@ -2339,5 +2336,5 @@
 
 %% store the current open names, fields and vel types in uvmat interface 
-UvData.filename_1=filename_1;
+UvData.FileName_1=FileName_1;
 
 %% apply coordinate transform or other user fct
@@ -2354,5 +2351,5 @@
 transform=transform_list{choice_value};%selected function handles
 % z index
-if ~isempty(filename)
+if ~isempty(FileName)
     Field{1}.ZIndex=z_index;
 end
@@ -2722,5 +2719,5 @@
                 hget_field=findobj(allchild(0),'name','get_field');
                 if isempty(hget_field)
-                    get_field(filename)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field)
+                    get_field(FileName)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field)
                 end
                 errormsg='The field defined by get_field cannot be plotted';
@@ -2947,9 +2944,9 @@
 % [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles);
 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
-filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
-%filename=read_file_boxes(handles);
-[erread,message]=fileattrib(filename);
+FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
+%FileName=read_file_boxes(handles);
+[erread,message]=fileattrib(FileName);
 if ~isempty(message) && ~isequal(message.UserWrite,1)
-     msgbox_uvmat('ERROR',['no writting access to ' filename])
+     msgbox_uvmat('ERROR',['no writting access to ' FileName])
      return
 end
@@ -2973,5 +2970,5 @@
 hhh=which('netcdf.open');% look for built-in matlab netcdf library
 if ~isequal(hhh,'')% case of new builtin Matlab netcdf library
-    nc=netcdf.open(filename,'NC_WRITE'); 
+    nc=netcdf.open(FileName,'NC_WRITE'); 
     netcdf.reDef(nc);
     netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1);
@@ -2986,5 +2983,5 @@
     netcdf.close(nc);  
 else %old netcdf library
-    netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
+    netcdf_toolbox(FileName,AxeData,attrname,nbname,flagname)
 end
 
@@ -2992,6 +2989,6 @@
 %----Correct the netcdf file, using toolbox (old versions of Matlab).
 %-------------------------------------------------------------------
-function netcdf_toolbox(filename,AxeData,attrname,nbname,flagname)
-nc=netcdf(filename,'write'); %open netcdf file
+function netcdf_toolbox(FileName,AxeData,attrname,nbname,flagname)
+nc=netcdf(FileName,'write'); %open netcdf file
 result=redef(nc);
 eval(['nc.' attrname '=1;']);
@@ -3090,11 +3087,11 @@
     set(handles.VelType_1,'visible','off')
     [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
-    filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
-    %filename=read_file_boxes(handles);
+    FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
+    %FileName=read_file_boxes(handles);
     hget_field=findobj(allchild(0),'name','get_field');
     if ~isempty(hget_field)
         delete(hget_field)
     end
-    hget_field=get_field(filename);
+    hget_field=get_field(FileName);
     set(hget_field,'Name','get_field')
     hhget_field=guidata(hget_field);
@@ -3147,7 +3144,7 @@
             '*.*',  'All Files (*.*)'}, ...
             'Pick a netcdf file',FileBase);
-        filename=[PathName FileName];
+        FullFileName=[PathName FileName];
         % display the selected field and related information
-        display_file_name( handles,filename)
+        display_file_name( handles,FullFileName)
         return
     end
@@ -3186,5 +3183,5 @@
     UvData=rmfield(UvData,'Field_1');% remove the stored second field (a new one needs to be read)
 end
-UvData.filename_1='';% desactivate the use of a constant second file
+UvData.FileName_1='';% desactivate the use of a constant second file
 list_fields=get(handles.Fields,'String');% list menu fields
 field= list_fields{get(handles.Fields,'Value')}; % selected string
@@ -3201,5 +3198,5 @@
 %% read the rootfile input display
 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles);
-filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];
+FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];
 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String'));
 % set(handles.FileIndex_1,'Visible','on')
@@ -3212,5 +3209,5 @@
             delete(hget_field)
         end
-        hget_field=get_field(filename_1);
+        hget_field=get_field(FileName_1);
         set(hget_field,'name','get_field_1')
         hhget_field=guidata(hget_field);
@@ -3326,20 +3323,20 @@
 set(handles.FixVelType,'Value',1)% the velocity type is now imposed by the GUI (not automatic)
 UvData=get(handles.uvmat,'UserData');
-%refresh field with a second filename=first file name
+%refresh field with a second FileName=first file name
 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
 drawnow   
 InputFile=read_GUI(handles.InputFile);
 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
-filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
+FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
 
 if isempty(InputFile.VelType_1)
-        filename_1='';% we plot the current field without the second field
+        FileName_1='';% we plot the current field without the second field
         set(handles.SubField,'Value',0)
         SubField_Callback(hObject, eventdata, handles)
 elseif get(handles.SubField,'Value')% if subfield is already 'on'
       [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles);
-     filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1];
+     FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1];
 else
-     filename_1=filename;% we compare two fields in the same file by default
+     FileName_1=FileName;% we compare two fields in the same file by default
      UvData.FileType{2}=UvData.FileType{1};
      set(handles.SubField,'Value',1)
@@ -3348,5 +3345,5 @@
     UvData=rmfield(UvData,'Field_1');% removes the stored second field if it exists
 end
-UvData.filename_1='';% desactivate the use of a constant second file
+UvData.FileName_1='';% desactivate the use of a constant second file
 set(handles.uvmat,'UserData',UvData)
 num_i1=stra2num(get(handles.i1,'String'));
@@ -3355,5 +3352,5 @@
 num_j2=stra2num(get(handles.j2,'String'));
 
-errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2);
+errormsg=refresh_field(handles,FileName,FileName_1,num_i1,num_i2,num_j1,num_j2);
 
 if ~isempty(errormsg)
Index: /trunk/src/xml2struct.m
===================================================================
--- /trunk/src/xml2struct.m	(revision 449)
+++ /trunk/src/xml2struct.m	(revision 450)
@@ -15,24 +15,32 @@
 
 
-function out=convert_string(s)
-info=whos('s');
+function out=convert_string(ss)
+info=whos('ss');
 switch info.class
     case 'struct'
-        names = fieldnames(s);
+        names = fieldnames(ss);
         for k=1:length(names)
-            out.(names{k})=convert_string(s.(names{k}));
+            out.(names{k})=convert_string(ss.(names{k}));
         end
     case 'char'   
-        if isempty(regexp(s,'^(-*\d+\.*\d*\ *)+$'))% if the string contains a set of numbers (with possible sign and decimal) separated by blanks
-            out=s;
+        if isempty(regexp(ss,'^(-*\d+\.*\d*\ *)+$'))% if the string does not contains a set of numbers (with possible sign and decimal) separated by blanks
+            sep_ind=regexp(ss,'\s&\s');% check for separator ' & ' which indicates column separation in tables
+            if ~isempty(sep_ind)
+                sep_ind=[-2 sep_ind length(ss)+1];
+                for icolumn=1:length(sep_ind)-1
+                    out{1,icolumn}=ss(sep_ind(icolumn)+3:sep_ind(icolumn+1)-1);
+                end
+            else
+                out=ss; %reproduce the input string
+            end
         else
-            out=str2num(s);
+            out=str2num(ss);
         end
     case 'cell'
-        for ilist=1:numel(s)
-            out(ilist,:)=str2num(s{ilist});
+        for ilist=1:numel(ss)
+            out(ilist,:)=str2num(ss{ilist});
         end
     otherwise
-        out=s;
+        out=ss;
 end
 
