Index: trunk/src/calc_field_interp.m
===================================================================
--- trunk/src/calc_field_interp.m	(revision 674)
+++ trunk/src/calc_field_interp.m	(revision 675)
@@ -50,15 +50,18 @@
             switch r.Operator
                 case 'curl'% case of CivX data format
+                    if ~isfield(Data,'DjUi'), errormsg='field DjUi needed to get curl through linear interp: use ProjMode=interp_tps'; return; end
                     UName{ilist}='vort';
                     Data.vort=Data.DjUi(:,1,2)-Data.DjUi(:,2,1);
                 case 'div'
+                    if ~isfield(Data,'DjUi'), errormsg='field DjUi needed to get div through linear interp: use ProjMode=interp_tps'; return; end
                     UName{ilist}='div';
                     Data.div=Data.DjUi(:,1,1)+Data.DjUi(:,2,2);
                 case 'strain'
+                    if ~isfield(Data,'DjUi'), errormsg='field DjUi needed to get strain through linear interp: use ProjMode=interp_tps'; return; end
                     UName{ilist}='strain';
                     Data.strain=Data.DjUi(:,1,2)+Data.DjUi(:,2,1);
             end
             InputVarList=[InputVarList UName{ilist}]; %the variable is added to the list if it is not already in the list
-        else
+        else % case  'norm' for instance
             UName{ilist}=r.UName;
             VName{ilist}=r.VName;
Index: trunk/src/calc_field_tps.m
===================================================================
--- trunk/src/calc_field_tps.m	(revision 674)
+++ trunk/src/calc_field_tps.m	(revision 675)
@@ -6,4 +6,6 @@
 % OUTPUT:
 % DataOut: structure representing the output fields
+% VarAttribute: cell array of structures coontaining the variable attributes 
+% errormsg: error msg , = '' by default
 %
 % INPUT:
@@ -14,5 +16,8 @@
 % NbCentre: nbre of tps centres for each subdomain, of dimension nb_subdomain
 % SubRange: coordinate range for each subdomain, of dimensions [nb_coord,2,nb_subdomain]
-% FieldVar: cell array of list of variables needed to calculate the requested fields
+% FieldVar: array representing the input fields as tps weights with dimension (nbvec_sub+3,NbSubDomain,nb_dim)
+%              nbvec_sub= max nbre of vectors in a subdomain  
+%             NbSubDomain =nbre of subdomains
+%             nb_dim: nbre of dimensions for vector components (x-> 1, y->2)
 % FieldName: cell array representing the list of operations (eg div(U,V), rot(U,V))
 % Coord_interp: coordinates of sites on which the fields need to be calculated of dimensions 
@@ -49,6 +54,10 @@
 check_grid=0;
 check_der=0;
+check_vec=0;
+check_remove=false(size(FieldName));
+VarAttribute={};
 for ilist=1:length(FieldName)
-    FieldNameType=regexprep(FieldName{ilist},'(.+','');
+    FieldNameType=regexprep(FieldName{ilist},'(.+','');% detect the char string before the parenthesis
+    VarAttributeNew={};
     switch FieldNameType
         case 'vec'
@@ -56,18 +65,29 @@
             DataOut.U=zeros(nb_sites,1);
             DataOut.V=zeros(nb_sites,1);
-            VarAttribute{1}.Role='vector_x';
-            VarAttribute{2}.Role='vector_y';
-        case {'U','V','norm'}
+            VarAttributeNew{1}.Role='vector_x';
+            VarAttributeNew{2}.Role='vector_y';
+            check_vec=1;
+        case {'U','V'}
+            if check_vec% no new data needed 
+                check_remove(ilist)=1;
+            else
             check_grid=1;
             DataOut.(FieldNameType)=zeros(nb_sites,1);
-            VarAttribute{1}.Role='scalar';
+            VarAttributeNew{1}.Role='scalar';
+            end
+        case 'norm'
+            check_grid=1;
+            DataOut.(FieldNameType)=zeros(nb_sites,1);
+            VarAttributeNew{1}.Role='scalar';
         case {'curl','div','strain'}
             check_der=1;
             DataOut.(FieldNameType)=zeros(nb_sites,1);
-            VarAttribute{1}.Role='scalar';
+            VarAttributeNew{1}.Role='scalar';
     end
+    VarAttribute=[VarAttribute VarAttributeNew];
 end
 Attr_FF.Role='errorflag';
 VarAttribute=[VarAttribute {Attr_FF}];
+FieldName(check_remove)=[];
 
 %% loop on subdomains
@@ -83,39 +103,39 @@
         [EMDX,EMDY] = tps_eval_dxy(Coord_interp(ind_sel,:),Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the spatial derivatives from tps 'sources'
     end
-    ListVar={};
+%     ListVar={};
     for ilist=1:length(FieldName)
-        var_count=numel(ListVar);
+%         var_count=numel(ListVar);
         switch FieldName{ilist}
             case 'vec(U,V)'
-                ListVar=[ListVar {'U', 'V'}];
-                VarAttribute{var_count+1}.Role='vector_x';
-                VarAttribute{var_count+2}.Role='vector_y';
+%                 ListVar=[ListVar {'U', 'V'}];
+%                 VarAttribute{var_count+1}.Role='vector_x';
+%                 VarAttribute{var_count+2}.Role='vector_y';
                 DataOut.U(ind_sel)=DataOut.U(ind_sel)+EM *FieldVar(1:nbvec_sub+3,isub,1);
                 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *FieldVar(1:nbvec_sub+3,isub,2);
             case 'U'
-                ListVar=[ListVar {'U'}];
-                VarAttribute{var_count+1}.Role='scalar';
+%                 ListVar=[ListVar {'U'}];
+%                 VarAttribute{var_count+1}.Role='scalar';
                 DataOut.U(ind_sel)=DataOut.U(ind_sel)+EM *FieldVar(1:nbvec_sub+3,isub,1);
             case 'V'
-                ListVar=[ListVar {'V'}];
-                VarAttribute{var_count+1}.Role='scalar';
+%                 ListVar=[ListVar {'V'}];
+%                 VarAttribute{var_count+1}.Role='scalar';
                 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *FieldVar(1:nbvec_sub+3,isub,2);
             case 'norm(U,V)'
-                ListVar=[ListVar {'norm'}];
-                VarAttribute{var_count+1}.Role='scalar';
+%                 ListVar=[ListVar {'norm'}];
+%                 VarAttribute{var_count+1}.Role='scalar';
                 U=DataOut.U(ind_sel)+EM *FieldVar(1:nbvec_sub+3,isub,1);
                 V=DataOut.V(ind_sel)+EM *FieldVar(1:nbvec_sub+3,isub,2);
                 DataOut.norm(ind_sel)=sqrt(U.*U+V.*V);
             case 'curl(U,V)'
-                ListVar=[ListVar {'curl'}];
-                VarAttribute{var_count+1}.Role='scalar';
+%                 ListVar=[ListVar {'curl'}];
+%                 VarAttribute{var_count+1}.Role='scalar';
                 DataOut.curl(ind_sel)=DataOut.curl(ind_sel)-EMDY *FieldVar(1:nbvec_sub+3,isub,1)+EMDX *FieldVar(1:nbvec_sub+3,isub,2);
             case 'div(U,V)'
-                ListVar=[ListVar {'div'}];
-                VarAttribute{var_count+1}.Role='scalar';
+%                 ListVar=[ListVar {'div'}];
+%                 VarAttribute{var_count+1}.Role='scalar';
                 DataOut.div(ind_sel)=DataOut.div(ind_sel)+EMDX*FieldVar(1:nbvec_sub+3,isub,1)+EMDY *FieldVar(1:nbvec_sub+3,isub,2);
             case 'strain(U,V)'
-                ListVar=[ListVar {'strain'}];
-                VarAttribute{var_count+1}.Role='scalar';
+%                 ListVar=[ListVar {'strain'}];
+%                 VarAttribute{var_count+1}.Role='scalar';
                 DataOut.strain(ind_sel)=DataOut.strain(ind_sel)+EMDY*FieldVar(1:nbvec_sub+3,isub,1)+EMDX *FieldVar(1:nbvec_sub+3,isub,2);
         end
Index: trunk/src/find_field_cells.m
===================================================================
--- trunk/src/find_field_cells.m	(revision 674)
+++ trunk/src/find_field_cells.m	(revision 675)
@@ -176,5 +176,5 @@
                 CellInfo{icell}.NbCentres_tps= ivar_remain(ivardim);% nbre of sites for each tps subdomain
                 check_cell(ivar_remain(ivardim))=1;% mark the variable as selected
-            elseif strcmp(VarDimName{ivardim}{1},DimCell{2}) && strcmp(VarDimName{ivardim}{3},DimCell{3})
+            elseif strcmp(VarDimName{ivardim}{1},DimCell{2}) && numel(VarDimName{ivardim})>=3 && strcmp(VarDimName{ivardim}{3},DimCell{3})
                 CellInfo{icell}.SubRange_tps=ivar_remain(ivardim);% subrange definiton for tps
                 check_cell(ivar_remain(ivardim))=1;% mark the variable as selected
@@ -247,5 +247,5 @@
 end
 
-% group the remaining variables in cells sharing the same coordinate variables
+%% group the remaining variables in cells sharing the same coordinate variables
 NewCellInfo={};
 NewCellDimIndex={};
Index: trunk/src/get_field.m
===================================================================
--- trunk/src/get_field.m	(revision 674)
+++ trunk/src/get_field.m	(revision 675)
@@ -727,5 +727,5 @@
         end
     end
-    var_component=find(test_component);% list of variable indices elligible as unstructured coordiantes
+    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]);
@@ -755,9 +755,10 @@
             end
         end
-        if isempty(coord_val)
+        if isempty(find(coord_val))
             coord_val=var_coord;% case of dimension coordinates
         end
         if numel(find(coord_val))<2
-            coord_val=[numel(var_component)+2 numel(var_component)+1];
+            %coord_val=[numel(var_component)+2 numel(var_component)+1];
+            coord_val=[1 2];
         end
         set(handles.Coord_x,'Value',coord_val(1))
Index: trunk/src/get_file_type.m
===================================================================
--- trunk/src/get_file_type.m	(revision 674)
+++ trunk/src/get_file_type.m	(revision 675)
@@ -17,7 +17,13 @@
 % fileinput: name, including path, of the file to analyse
 function [FileType,FileInfo,VideoObject]=get_file_type(fileinput)
-FileType='txt';%default, text file
+
 FileInfo=[];
 VideoObject=[];
+if exist(fileinput,'file')
+    FileType='txt';%default, text file
+else
+    FileType='';
+    return
+end
 [tild,tild,FileExt]=fileparts(fileinput);
 
Index: trunk/src/imadoc2struct.m
===================================================================
--- trunk/src/imadoc2struct.m	(revision 674)
+++ trunk/src/imadoc2struct.m	(revision 675)
@@ -47,4 +47,7 @@
 %% reading timing
 if isfield(s,'Camera')
+    if isfield(s.Camera,'TimeUnit')
+        s.TimeUnit=s.Camera.TimeUnit;
+    end
     Timing=s.Camera.BurstTiming;
     if ~iscell(Timing)
@@ -105,204 +108,4 @@
 end
 
-% try
-%     t=xmltree(ImaDoc);
-% catch ME
-%     errormsg={['error reading ' ImaDoc ': ']; ME.message};
-%     display(errormsg);
-%     return
-% end
-% uid_root=find(t,'/ImaDoc');
-% if isempty(uid_root), return; end;%not an ImaDoc .xml file
-
-% %% Heading
-% uid_Heading=find(t,'/ImaDoc/Heading');
-% if ~isempty(uid_Heading), 
-%     uid_Campaign=find(t,'/ImaDoc/Heading/Campaign');
-%     uid_Exp=find(t,'/ImaDoc/Heading/Experiment');
-%     uid_Device=find(t,'/ImaDoc/Heading/Device');
-%     uid_Record=find(t,'/ImaDoc/Heading/Record');
-%     uid_FirstImage=find(t,'/ImaDoc/Heading/ImageName');
-%     s.Heading.Campaign=get(t,children(t,uid_Campaign),'value');
-%     s.Heading.Experiment=get(t,children(t,uid_Exp),'value');
-%     s.Heading.Device=get(t,children(t,uid_Device),'value');
-%     if ~isempty(uid_Record)
-%         s.Heading.Record=get(t,children(t,uid_Record),'value');
-%     end
-%     s.Heading.ImageName=get(t,children(t,uid_FirstImage),'value');
-% end
-
-%% Camera  and timing
-% if strcmp(option,'*') || strcmp(option,'Camera')
-%     uid_Camera=find(t,'/ImaDoc/Camera');
-%     if ~isempty(uid_Camera)
-%         uid_ImageSize=find(t,'/ImaDoc/Camera/ImageSize');
-%         if ~isempty(uid_ImageSize);
-%             ImageSize=get(t,children(t,uid_ImageSize),'value');
-%             xindex=findstr(ImageSize,'x');
-%             if length(xindex)>=2
-%                 s.Npx=str2double(ImageSize(1:xindex(1)-1));
-%                 s.Npy=str2double(ImageSize(xindex(1)+1:xindex(2)-1));
-%             end
-%         end
-%         uid_TimeUnit=find(t,'/ImaDoc/Camera/TimeUnit');
-%         if ~isempty(uid_TimeUnit)
-%             s.TimeUnit=get(t,children(t,uid_TimeUnit),'value');
-%         end
-%         uid_BurstTiming=find(t,'/ImaDoc/Camera/BurstTiming');
-%         if ~isempty(uid_BurstTiming)
-%             for k=1:length(uid_BurstTiming)
-%                 subt=branch(t,uid_BurstTiming(k));%subtree under BurstTiming
-%                 % reading Dtk
-%                 Frequency=get_value(subt,'/BurstTiming/FrameFrequency',1);
-%                 Dtj=get_value(subt,'/BurstTiming/Dtj',[]);
-%                 Dtj=Dtj/Frequency;%Dtj converted from frame unit to TimeUnit (e.g. 's')
-%                 NbDtj=get_value(subt,'/BurstTiming/NbDtj',1);
-%                 Dti=get_value(subt,'/BurstTiming/Dti',[]);
-%                 Dti=Dti/Frequency;%Dtj converted from frame unit to TimeUnit (e.g. 's')
-%                 NbDti=get_value(subt,'/BurstTiming/NbDti',1);
-%                 Time_val=get_value(subt,'/BurstTiming/Time',0);%time in TimeUnit
-%                 if ~isempty(Dti)
-%                     Dti=reshape(Dti'*ones(1,NbDti),NbDti*numel(Dti),1); %concatene Dti vector NbDti times
-%                     Time_val=[Time_val;Time_val(end)+cumsum(Dti)];%append the times defined by the intervals  Dti
-%                 end
-%                 if ~isempty(Dtj)
-%                     Dtj=reshape(Dtj'*ones(1,NbDtj),1,NbDtj*numel(Dtj)); %concatene Dtj vector NbDtj times
-%                     Dtj=[0 Dtj];
-%                     Time_val=Time_val*ones(1,numel(Dtj))+ones(numel(Time_val),1)*cumsum(Dtj);% produce a time matrix with Dtj
-%                 end
-%                 % reading Dtk
-%                 Dtk=get_value(subt,'/BurstTiming/Dtk',[]);
-%                 NbDtk=get_value(subt,'/BurstTiming/NbDtk',1);
-%                 if isempty(Dtk)
-%                     s.Time=[s.Time;Time_val];
-%                 else
-%                     for kblock=1:NbDtk+1
-%                         Time_val_k=Time_val+(kblock-1)*Dtk;
-%                         s.Time=[s.Time;Time_val_k];
-%                     end
-%                 end
-%             end
-%         end
-%     end
-% end
-
-%% motor
-% if strcmp(option,'*') || strcmp(option,'GeometryCalib')
-%     uid_subtree=find(t,'/ImaDoc/TranslationMotor');
-%     if length(uid_subtree)==1
-%         subt=branch(t,uid_subtree);%subtree under GeometryCalib
-%        [s.TranslationMotor,errormsg]=read_subtree(subt,{'Nbslice','ZStart','ZEnd'},[1 1 1],[1 1 1]);
-%     end 
-% end
-%%  geometric calibration
-% if strcmp(option,'*') || strcmp(option,'GeometryCalib')
-%     uid_GeometryCalib=find(t,'/ImaDoc/GeometryCalib');
-%     if ~isempty(uid_GeometryCalib)
-%         if length(uid_GeometryCalib)>1
-%             errormsg=['More than one GeometryCalib in ' filecivxml];
-%             return
-%         end
-%         subt=branch(t,uid_GeometryCalib);%subtree under GeometryCalib
-%         cont=get(subt,1,'contents');
-%         if ~isempty(cont)
-%             uid_CalibrationType=find(subt,'/GeometryCalib/CalibrationType');
-%             if isequal(length(uid_CalibrationType),1)
-%                 tsai.CalibrationType=get(subt,children(subt,uid_CalibrationType),'value');
-%             end
-%             uid_CoordUnit=find(subt,'/GeometryCalib/CoordUnit');
-%             if isequal(length(uid_CoordUnit),1)
-%                 tsai.CoordUnit=get(subt,children(subt,uid_CoordUnit),'value');
-%             end
-%             uid_fx_fy=find(subt,'/GeometryCalib/fx_fy');
-%             focal=[];%default fro old convention (Reg Wilson)
-%             if isequal(length(uid_fx_fy),1)
-%                 tsai.fx_fy=str2num(get(subt,children(subt,uid_fx_fy),'value'));
-%             else %old convention (Reg Wilson)
-%                 uid_focal=find(subt,'/GeometryCalib/focal');
-%                 uid_dpx_dpy=find(subt,'/GeometryCalib/dpx_dpy');
-%                 uid_sx=find(subt,'/GeometryCalib/sx');
-%                 if ~isempty(uid_focal) && ~isempty(uid_dpx_dpy) && ~isempty(uid_sx)
-%                     dpx_dpy=str2num(get(subt,children(subt,uid_dpx_dpy),'value'));
-%                     sx=str2num(get(subt,children(subt,uid_sx),'value'));
-%                     focal=str2num(get(subt,children(subt,uid_focal),'value'));
-%                     tsai.fx_fy(1)=sx*focal/dpx_dpy(1);
-%                     tsai.fx_fy(2)=focal/dpx_dpy(2);
-%                 end
-%             end
-%             uid_Cx_Cy=find(subt,'/GeometryCalib/Cx_Cy');
-%             if ~isempty(uid_Cx_Cy)
-%                 tsai.Cx_Cy=str2num(get(subt,children(subt,uid_Cx_Cy),'value'));
-%             end
-%             uid_kc=find(subt,'/GeometryCalib/kc');
-%             if ~isempty(uid_kc)
-%                 tsai.kc=str2double(get(subt,children(subt,uid_kc),'value'));
-%             else %old convention (Reg Wilson)
-%                 uid_kappa1=find(subt,'/GeometryCalib/kappa1');
-%                 if ~isempty(uid_kappa1)&& ~isempty(focal)
-%                     kappa1=str2double(get(subt,children(subt,uid_kappa1),'value'));
-%                     tsai.kc=-kappa1*focal*focal;
-%                 end
-%             end
-%             uid_Tx_Ty_Tz=find(subt,'/GeometryCalib/Tx_Ty_Tz');
-%             if ~isempty(uid_Tx_Ty_Tz)
-%                 tsai.Tx_Ty_Tz=str2num(get(subt,children(subt,uid_Tx_Ty_Tz),'value'));
-%             end
-%             uid_R=find(subt,'/GeometryCalib/R');
-%             if ~isempty(uid_R)
-%                 RR=get(subt,children(subt,uid_R),'value');
-%                 if length(RR)==3
-%                     tsai.R=[str2num(RR{1});str2num(RR{2});str2num(RR{3})];
-%                 end
-%             end
-%             
-%             %look for laser plane definitions
-%             uid_Angle=find(subt,'/GeometryCalib/PlaneAngle');
-%             uid_Pos=find(subt,'/GeometryCalib/SliceCoord');
-%             if isempty(uid_Pos)
-%                 uid_Pos=find(subt,'/GeometryCalib/PlanePos');%old convention
-%             end
-%             if ~isempty(uid_Angle)
-%                 tsai.PlaneAngle=str2num(get(subt,children(subt,uid_Angle),'value'));
-%             end
-%             if ~isempty(uid_Pos)
-%                 for j=1:length(uid_Pos)
-%                     tsai.SliceCoord(j,:)=str2num(get(subt,children(subt,uid_Pos(j)),'value'));
-%                 end
-%                 uid_DZ=find(subt,'/GeometryCalib/SliceDZ');
-%                 uid_NbSlice=find(subt,'/GeometryCalib/NbSlice');
-%                 if ~isempty(uid_DZ) && ~isempty(uid_NbSlice)
-%                     DZ=str2double(get(subt,children(subt,uid_DZ),'value'));
-%                     NbSlice=get(subt,children(subt,uid_NbSlice),'value');
-%                     if isequal(NbSlice,'volume')
-%                         tsai.NbSlice='volume';
-%                         NbSlice=NbDtj+1;
-%                     else
-%                         tsai.NbSlice=str2double(NbSlice);
-%                     end
-%                     tsai.SliceCoord=ones(NbSlice,1)*tsai.SliceCoord+DZ*(0:NbSlice-1)'*[0 0 1];
-%                 end
-%             end   
-%             tsai.SliceAngle=get_value(subt,'/GeometryCalib/SliceAngle',[0 0 0]);
-%             tsai.VolumeScan=get_value(subt,'/GeometryCalib/VolumeScan','n');
-%             tsai.InterfaceCoord=get_value(subt,'/GeometryCalib/InterfaceCoord',[0 0 0]);
-%             tsai.RefractionIndex=get_value(subt,'/GeometryCalib/RefractionIndex',1);
-%             
-%             if strcmp(option,'GeometryCalib')
-%                 tsai.PointCoord=get_value(subt,'/GeometryCalib/SourceCalib/PointCoord',[0 0 0 0 0]);
-%             end
-%             s.GeometryCalib=tsai;
-%         end
-%     end
-% end
-
-%--------------------------------------------------
-%  read a subtree
-% INPUT: 
-% t: xltree
-% head_element: head elelemnt of the subtree
-% Data, structure containing 
-%    .Key: element name
-%    .Type: type of element ('charg', 'float'....)
-%    .NbOccur: nbre of occurrence, NaN for un specified number 
 function [s,errormsg]=read_subtree(subt,Data,NbOccur,NumTest)
 %--------------------------------------------------
Index: trunk/src/mask_proj.m
===================================================================
--- trunk/src/mask_proj.m	(revision 674)
+++ trunk/src/mask_proj.m	(revision 675)
@@ -31,12 +31,10 @@
 end
 [Npy,Npx]=size(MaskData.A);
-DX=(MaskData.AX(2)-MaskData.AX(1))/(Npx-1);
-DY=(MaskData.AY(2)-MaskData.AY(1))/(Npy-1);
+
 for icell=1:numel(CellInfo)
     if NbDimArray(icell)==2
-        XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)};
-        YName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)};
         if isfield(CellInfo{icell},'VarIndex_errorflag')
             FFName=FieldData.ListVarName{CellInfo{icell}.VarIndex_errorflag};
+            check_new_error_flag=0;
         else
             FFName='FF';%default error (mask) flag name (if not already used)
@@ -49,9 +47,13 @@
             end
             ProjData.ListVarName=[FieldData.ListVarName {FFName}];
-            ProjData.VarDimName=[FieldData.VarDimName FieldData.VarDimName(CellInfo{icell}.CoordIndex(1))];
-            ProjData.VarAttribute{numel(FieldData.VarDimName)}.Role='errorflag';
+            ProjData.VarAttribute{numel(ProjData.ListVarName)}.Role='errorflag';
+            check_new_error_flag=1;
         end
         switch CellInfo{icell}.CoordType;
-            case  'scattered'               
+            case  'scattered'   
+                XName=FieldData.ListVarName{CellInfo{icell}.Coord_x};
+                YName=FieldData.ListVarName{CellInfo{icell}.Coord_y};
+                DX=(MaskData.AX(2)-MaskData.AX(1))/(Npx-1);
+                DY=(MaskData.AY(2)-MaskData.AY(1))/(Npy-1);
                 mask_ind_i=round(0.5+(FieldData.(XName)-MaskData.AX(1))/DX);%nbpoint terms
                 mask_ind_j=round(0.5+(FieldData.(YName)-MaskData.AY(1))/DY);%nbpoint terms
@@ -65,17 +67,18 @@
                     ProjData.(VarName)(checkfalse)=0;
                 end
-                if ~isfield(CellInfo{icell},'VarIndex_errorflag')% an error flag already exists in the current cell
+                if check_new_error_flag% an error flag needs to be created in the current cell
                     ProjData.(FFName)=zeros(size(ProjData.(VarName)));
+                    ProjData.VarDimName=[FieldData.VarDimName FieldData.VarDimName(CellInfo{icell}.VarIndex(1))];
                 end
-                ProjData.(FFName)(checkfalse)=1;
+                ProjData.(FFName)(checkfalse)=1;% update the existing error flag             
             case  'grid'
+                XName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(2)};
+                YName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)};
                 Var1Name=FieldData.ListVarName{CellInfo{icell}.VarIndex(1)};
                 [Npy_field,Npx_field]=size(FieldData.(Var1Name));
-                DX_field=(FieldData.(XName)(end)-FieldData.(XName)(1))/(Npx_field-1);
-                DY_field=(FieldData.(YName)(end)-FieldData.(YName)(1))/(Npy_field-1);
-                XArray=FieldData.(XName)(1):DX_field:FieldData.(XName)(end);
-                YArray=FieldData.(YName)(1):DY_field:FieldData.(YName)(end);
-                XMask=MaskData.AX(1):DX:MaskData.AX(end);
-                YMask=MaskData.AY(end):-DY:MaskData.AY(1);
+                XArray=linspace(FieldData.(XName)(1),FieldData.(XName)(end),Npx_field);
+                YArray=linspace(FieldData.(YName)(1),FieldData.(YName)(end),Npy_field);
+                XMask=linspace(MaskData.AX(1),MaskData.AX(end),Npx);
+                YMask=linspace(MaskData.AY(1),MaskData.AY(end),Npy);
                 [XMask,YMask]=meshgrid(XMask,YMask);
                 Mask = interp2(XMask,YMask,MaskData.A,XArray,YArray','nearest');
@@ -87,8 +90,9 @@
                     end
                 end
-                if isfield(CellInfo{icell},'VarIndex_errorflag')% an error flag already exists in the current cell
+                if check_new_error_flag% an error flag needs to be created in the current cell
+                    ProjData.(FFName)= ~Mask;
+                    ProjData.VarDimName=[FieldData.VarDimName FieldData.VarDimName(CellInfo{icell}.VarIndex(1))];
+                else
                     ProjData.(FFName)=FieldData.(FFName) | ~Mask;
-                else
-                    ProjData.(FFName)= ~Mask;
                 end
         end
Index: trunk/src/proj_field.m
===================================================================
--- trunk/src/proj_field.m	(revision 674)
+++ trunk/src/proj_field.m	(revision 675)
@@ -562,7 +562,7 @@
             NbPoint=ceil(LineLength/DX);
             DX=LineLength/NbPoint;%adjust DX to get an integer nbre of intervals in a closed line
-            DX_end=DX/2;
+            DX_edge=DX/2;
         else
-            DX_end=(LineLength-DX*floor(LineLength/DX))/2;%margin from the first point and first interpolation point
+            DX_edge=(LineLength-DX*floor(LineLength/DX))/2;%margin from the first point and first interpolation point, the same for the end point
         end
         XI=[];
@@ -571,5 +571,5 @@
         dlengthI=[];
         if strcmp(ObjectData.Type,'ellipse')
-            phi=(DX_end:DX:LineLength)*2*pi/LineLength;
+            phi=(DX_edge:DX:LineLength)*2*pi/LineLength;
             XI=ObjectData.RangeX*cos(phi);
             YI=ObjectData.RangeY*sin(phi);
@@ -580,16 +580,21 @@
                 costheta=cos(theta(isegment));
                 sintheta=sin(theta(isegment));
-                XIsegment=(LineCoord(isegment,1)+DX_end*costheta:DX*costheta:LineCoord(isegment+1,1));
-                YIsegment=(LineCoord(isegment,2)+DX_end*sintheta:DX*sintheta:LineCoord(isegment+1,2));
+%                 XIsegment=LineCoord(isegment,1)+DX_edge*costheta:DX*costheta:LineCoord(isegment+1,1));
+%                 YIsegment=(LineCoord(isegment,2)+DX_edge*sintheta:DX*sintheta:LineCoord(isegment+1,2));
+                NbInterval=floor((dlength(isegment)-DX_edge)/DX);
+                LastX=DX_edge+DX*NbInterval;
+                NbPoint=NbInterval+1;
+                XIsegment=linspace(LineCoord(isegment,1)+DX_edge*costheta,LineCoord(isegment,1)+LastX*costheta,NbPoint);
+                YIsegment=linspace(LineCoord(isegment,2)+DX_edge*sintheta,LineCoord(isegment,2)+LastX*sintheta,NbPoint);
                 XI=[XI XIsegment];
                 YI=[YI YIsegment];
                 ThetaI=[ThetaI theta(isegment)*ones(1,numel(XIsegment))];
                 dlengthI=[dlengthI DX*ones(1,numel(XIsegment))];
-                DX_end=DX_end+DX-(dlength(isegment)-DX*(numel(XIsegment)-1));
+                DX_edge=DX-(dlength(isegment)-LastX);%edge for the next segment set to keep DX=DX_end+DX_edge between two segments
             end
         end
         Xproj=cumsum(dlengthI);
     else
-        errormsg='mesh DX needed for interpolation';
+        errormsg='abscissa mesh along line DX needed for interpolation';
         return
     end
@@ -713,6 +718,4 @@
                 [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord,NbCentres,SubRange,FieldVar,CellInfo{icell}.FieldName,cat(3,XI,YI));
                 ProjData.X=Xproj;
-%                 ProjData.ListVarName=[ProjData.ListVarName {XName}];
-%                 ProjData.VarDimName=[ProjData.VarDimName {XName}];
                 nbvar=numel(ProjData.ListVarName);
                 ProjData.VarAttribute{nbvar}.long_name='abscissa along line';
@@ -923,7 +926,4 @@
     testXMin=XMax>XMin;
     testXMax=1;% range restriction along X
-    % else
-    %     XMin=FieldData.XMin;%default
-    %     XMax=FieldData.XMax;%default
 end
 if isfield(ObjectData,'RangeY')
@@ -932,7 +932,4 @@
     testYMin=YMax>YMin;
     testYMax=1;
-    % else
-    %     YMin=FieldData.YMin;%default
-    %     YMax=FieldData.YMax;%default
 end
 width=0;%default width of the projection band
@@ -1036,107 +1033,4 @@
             if ~isfield(FieldData,'XMax')
                 FieldData=find_field_bounds(FieldData);
-%             CellIndex=find(check_grid);
-%             for igrid=1:numel(CellIndex)
-%                 icell=CellIndex(igrid);% TODO: recalculate coordinates here to get the bounds in the rotated coordinates
-%                 NbDim=NbDimArray(icell);
-%                 for idim=1:NbDim %loop on space dimensions
-%                     ivar=CellInfo{icell}.CoordIndex(idim);% index of the variable corresponding to the current dimension
-%                     Coord{idim}=FieldData.(FieldData.ListVarName{ivar});% coord values for the input field
-%                     if ~isequal(ivar,0)%  a variable corresponds to the dimension #idim
-%                         
-%                         
-%                         
-%                     else
-%                                                     Coord_i_str=['Coord_' num2str(idim)];
-%                             DCoord_min(idim)=1;%default
-%                             Coord{idim}=[0.5 DimValue(idim)-0.5];
-%                             test_direct(idim)=1;
-%                     end
-%                 % default bounds, case of gridded data
-%                 if strcmp(CellInfo{icell}.CoordType,'grid')
-%                     % find default mesh
-%                     for idim=1:NbDim %loop on space dimensions
-%                         test_interp(idim)=0;%test for coordiate interpolation (non regular grid), =0 by default
-%                         ivar=CellInfo{icell}.CoordIndex(idim);% index of the variable corresponding to the current dimension
-%                         DimValue=size(FieldData.(FieldData.ListVarName{ivar}));
-%                         if ~isequal(ivar,0)%  a variable corresponds to the dimension #idim
-%                             Coord{idim}=FieldData.(FieldData.ListVarName{ivar});% coord values for the input field
-%                             if numel(Coord{idim})==2 %input array defined on a regular grid
-%                                 DCoord_min(idim)=(Coord{idim}(2)-Coord{idim}(1))/DimValue(idim);
-%                                 Coord{idim}=linspace(Coord{idim}(1),Coord{idim}(2),DimValue(idim));
-%                             else
-%                                 DCoord=diff(Coord{idim});%array of coordinate derivatives for the input field
-%                                 DCoord_min(idim)=min(DCoord);
-%                                 DCoord_max=max(DCoord);
-%                                 if abs(DCoord_max-DCoord_min(idim))>abs(DCoord_max/1000)
-%                                     msgbox_uvmat('ERROR',['non monotonic dimension variable # ' num2str(idim)  ' in proj_field.m'])
-%                                     return
-%                                 end
-%                                 test_interp(idim)=(DCoord_max-DCoord_min(idim))> 0.0001*abs(DCoord_max);% test grid regularity
-%                             end
-%                             test_direct(idim)=(DCoord_min(idim)>0);
-%                         else  % no variable associated with the  dimension #idim, the coordinate value is set equal to the matrix index by default
-% %                             Coord_i_str=['Coord_' num2str(idim)];
-% %                             DCoord_min(idim)=1;%default
-% %                             Coord{idim}=[0.5 DimValue(idim)-0.5];
-% %                             test_direct(idim)=1;
-%                         end
-%                     end
-%                     if isempty(DY)
-%                         DY=abs(DCoord_min(NbDim-1));
-%                     end
-%                     npY=1+round(abs(Coord{NbDim-1}(end)-Coord{NbDim-1}(1))/DY);%nbre of points after interpol
-%                     if isempty(DX)
-%                         DX=abs(DCoord_min(NbDim));
-%                     end
-%                     npX=1+round(abs(Coord{NbDim}(end)-Coord{NbDim}(1))/DX);%nbre of points after interpol
-%                     for idim=1:NbDim
-%                         if test_interp(idim)
-%                             DimValue(idim)=1+round(abs(Coord{idim}(end)-Coord{idim}(1))/abs(DCoord_min(idim)));%nbre of points after possible interpolation on a regular gri
-%                         end
-%                     end
-%                     Coord_y=linspace(Coord{NbDim-1}(1),Coord{NbDim-1}(end),npY);
-%                     test_direct_y=test_direct(NbDim-1);
-%                     Coord_x=linspace(Coord{NbDim}(1),Coord{NbDim}(end),npX);
-%                     test_direct_x=test_direct(NbDim);
-%                     DAX=DCoord_min(NbDim);
-%                     DAY=DCoord_min(NbDim-1);
-%                     minAX=min(Coord_x);
-%                     maxAX=max(Coord_x);
-%                     minAY=min(Coord_y);
-%                     maxAY=max(Coord_y);
-%                     xcorner=[minAX maxAX minAX maxAX]-ObjectData.Coord(1,1);% image corners in the new coordiantes
-%                     ycorner=[maxAY maxAY minAY minAY]-ObjectData.Coord(1,2);
-%                     xcor_new=xcorner*cos_om+ycorner*sin_om;%coord new frame
-%                     ycor_new=-xcorner*sin_om+ycorner*cos_om;
-%                     if ~testXMax
-%                         XMax(igrid)=max(xcor_new);
-%                     end
-%                     if ~testXMin
-%                         XMin(igrid)=min(xcor_new);
-%                     end
-%                     if ~testYMax
-%                         YMax(igrid)=max(ycor_new);
-%                     end
-%                     if ~testYMin
-%                         YMin(igrid)=min(ycor_new);
-%                     end
-%                     DX(igrid)=(maxAX-minAX)/(DimValue(NbDim)-1);
-%                     DY(igrid)=(maxAY-minAY)/(DimValue(NbDim-1)-1);
-%                     if NbDim==3
-%                         DZ(igrid)=(Coord{1}(end)-Coord{1}(1))/(DimValue(1)-1);
-%                         if ~test_direct(1)
-%                             DZ=-DZ;
-%                         end
-%                         Coord_z=linspace(Coord{1}(1),Coord{1}(end),DimValue(1));
-%                         test_direct_z=test_direct(1);
-%                     end
-%                 else
-%                     
-%                 end
-%                 YMax=max(YMax);
-%                 YMin=min(YMin);
-%                 XMax=max(XMax);
-%                 XMin=min(XMin);
             end
         end
@@ -1188,15 +1082,4 @@
     end
     VarIndex=CellInfo{icell}.VarIndex;%  indices of the selected variables in the list FieldData.ListVarName
-    %     ivar_U=[];ivar_V=[];ivar_W=[];
-    %     if isfield(CellInfo{icell},'VarIndex_vector_x_tps')&&isfield(CellInfo{icell},'VarIndex_vector_y_tps')
-    %         ivar_U=CellInfo{icell}.VarIndex_vector_x_tps;
-    %         ivar_V=CellInfo{icell}.VarIndex_vector_y_tps;
-    %     elseif isfield(CellInfo{icell},'VarIndex_vector_x')&&isfield(CellInfo{icell},'VarIndex_vector_y')
-    %         ivar_U=CellInfo{icell}.VarIndex_vector_x;
-    %         ivar_V=CellInfo{icell}.VarIndex_vector_y;
-    %     end
-    %     if isfield(CellInfo{icell},'VarIndex_vector_z')
-    %         ivar_W=CellInfo{icell}.VarIndex_vector_z;
-    %     end
     %dimensions
     DimCell=FieldData.VarDimName{VarIndex(1)};
@@ -1390,65 +1273,8 @@
             Coord_x=[];
             
-            
-            
-            %             % default bounds
-            %             minAX=min(Coord_x);
-            %             maxAX=max(Coord_x);
-            %             minAY=min(Coord_y);
-            %             maxAY=max(Coord_y);
-            %             xcorner=[minAX maxAX minAX maxAX]-ObjectData.Coord(1,1);% image corners in the new coordiantes
-            %             ycorner=[maxAY maxAY minAY minAY]-ObjectData.Coord(1,2);
-            %             xcor_new=xcorner*cos_om+ycorner*sin_om;%coord new frame
-            %             ycor_new=-xcorner*sin_om+ycorner*cos_om;
-            %             if ~testXMax
-            %                 XMax=max(xcor_new);
-            %             end
-            %             if ~testXMin
-            %                 XMin=min(xcor_new);
-            %             end
-            %             if ~testYMax
-            %                 YMax=max(ycor_new);
-            %             end
-            %             if ~testYMin
-            %                 YMin=min(ycor_new);
-            %             end
-            %             DXinit=(maxAX-minAX)/(DimValue(NbDim)-1);
-            %             DYinit=(maxAY-minAY)/(DimValue(NbDim-1)-1);
-            %             if DX==0
-            %                 DX=DXinit;
-            %             end
-            %             if DY==0
-            %                 DY=DYinit;
-            %             end
-            %             if NbDim==3
-            %                 DZ=(Coord{1}(end)-Coord{1}(1))/(DimValue(1)-1);
-            %                 if ~test_direct(1)
-            %                     DZ=-DZ;
-            %                 end
-            %                 Coord_z=linspace(Coord{1}(1),Coord{1}(end),DimValue(1));
-            %                 test_direct_z=test_direct(1);
-            %             end
-            %define new coordiantes if not already done by the definition of a projection grid
-            if ~check_grid
-                
-                
-            end
-            
             if testangle
                 ProjMode{icell}='interp_lin'; %request linear interpolation for projection on a tilted plane
             end
-            
-            %             npX=floor((XMax-XMin)/DX+1);
-            %             npY=floor((YMax-YMin)/DY+1);
-            %             if test_direct_y
-            %                 coord_y_proj=linspace(YMin,YMax,npY);%abscissa of the new pixels along the line
-            %             else
-            %                 coord_y_proj=linspace(YMax,YMin,npY);%abscissa of the new pixels along the line
-            %             end
-            %             if test_direct_x
-            %                 coord_x_proj=linspace(XMin,XMax,npX);%abscissa of the new pixels along the line
-            %             else
-            %                 coord_x_proj=linspace(XMax,XMin,npX);%abscissa of the new pixels along the line
-            %             end
+
             if isequal(ProjMode{icell},'projection')% && (~testangle || test90y || test90x)
                 if  NbDim==2 && ~testXMin && ~testXMax && ~testYMin && ~testYMax% no range restriction
Index: trunk/src/read_field.m
===================================================================
--- trunk/src/read_field.m	(revision 674)
+++ trunk/src/read_field.m	(revision 675)
@@ -69,4 +69,6 @@
     case 'netcdf'
         ListVar={};
+        Role={};
+        ProjModeRequest={};
         for ilist=1:numel(InputField)
             r=regexp(InputField{ilist},'(?<Operator>(^vec|^norm))\((?<UName>.+),(?<VName>.+)\)$','names');
@@ -81,13 +83,20 @@
                 end
             else  % an operator 'vec' or 'norm' is used
-                ListVar=[ListVar {r.UName,r.VName}];
-                Role{numel(ListVar)}='vector_y';
-                Role{numel(ListVar)-1}='vector_x';
                 if ~check_colorvar(ilist) && strcmp(r.Operator,'norm')
-                    ProjModeRequest{numel(ListVar)-1}='interp_lin';%scalar field (requires interpolation for plot)
-                    ProjModeRequest{numel(ListVar)}='interp_lin';
+                    ProjModeRequestVar='interp_lin';%scalar field (requires interpolation for plot)
                 else
-                    ProjModeRequest{numel(ListVar)-1}='';
-                    ProjModeRequest{numel(ListVar)}='';
+                    ProjModeRequestVar='';
+                end
+                ind_var_U=find(strcmp(r.UName,ListVar));%check previous listing of variable r.UName
+                ind_var_V=find(strcmp(r.VName,ListVar));%check previous listing of variable r.VName
+                if isempty(ind_var_U)
+                    ListVar=[ListVar r.UName]; % append the variable in the list if not previously listed
+                    Role=[Role {'vector_x'}];
+                    ProjModeRequest=[ProjModeRequest {ProjModeRequestVar}];
+                end
+                if isempty(ind_var_V)
+                    ListVar=[ListVar r.VName];% append the variable in the list if not previously listed
+                    Role=[Role {'vector_y'}];
+                    ProjModeRequest=[ProjModeRequest {ProjModeRequestVar}];
                 end
             end
@@ -101,4 +110,11 @@
             errormsg=Field.Txt;
             return
+        end
+        for ilist=3:numel(Field.VarDimName)
+            if isequal(Field.VarDimName{1},Field.VarDimName{ilist})
+                Field.VarAttribute{1}.Role='coord_x';%unstructured coordinates
+                Field.VarAttribute{2}.Role='coord_y';
+                break
+            end
         end
         for ivar=1:numel(ListVar)
@@ -109,4 +125,5 @@
             Field.VarAttribute{ivar+2}.ProjModeRequest=ProjModeRequest{ivar};
         end
+
     case 'video'
         if strcmp(class(ParamIn),'VideoReader')
Index: trunk/src/read_multimadoc.m
===================================================================
--- trunk/src/read_multimadoc.m	(revision 674)
+++ trunk/src/read_multimadoc.m	(revision 675)
@@ -7,4 +7,5 @@
 % NbSlice_calib: nbre of slices detected in the geometric calibration data
 % Time(iview,i,j): matrix of times, iview =index of the series, i,j=file indices within the series
+%                if the time is not consistent in all series, the time from the first series is chosen
 % warnmsg: warning message, ='' if  OK
 %
@@ -59,20 +60,19 @@
 
 function time=get_time(timeimadoc,i1_series,i2_series,j1_series,j2_series)
-if isempty(i2_series)||size(timeimadoc,1) < i2_series(end) ||( ~isempty(j2_series) && size(timeimadoc,2) < j2_series(end))% time array absent or too short in ImaDoc xml file'
-    time=[];
-else
-    timevect=timeimadoc';
-    if ~isempty(j1_series)
-        vect_index=reshape(j1_series+(i1_series-1)*size(timevect,1),1,[]);
-        time=timevect(vect_index);
-        if ~isempty(j2_series)
-            vect_index=reshape(j2_series+(i1_series-1)*size(timevect,1),1,[]);
-            time=(time+timevect(vect_index))/2;
-        end
-    else
-        time=timevect(i1_series);
-        if ~isempty(i2_series)
-            time=(time+timevect(i2_series))/2;
-        end
-    end
-end
+ time=[];
+ if ~ (isempty(i2_series)||size(timeimadoc,1) < i2_series(end) ||( ~isempty(j2_series) && size(timeimadoc,2) < j2_series(end)))% time array absent or too short in ImaDoc xml file'
+     if isempty(j1_series)
+         j1_series=1;
+     end
+     time=timeimadoc(i1_series+1,j1_series+1);
+     if ~isempty(j2_series)
+         time=[time timeimadoc(i1_series+1,j2_series+1)];
+     end
+     if ~isempty(i2_series)
+         time=[time timeimadoc(i2_series+1,j1_series+1)];
+         if ~isempty(j2_series)
+             time=[time timeimadoc(i2_series+1,j2_series+1)];
+         end
+     end
+ time=mean(time);
+ end
Index: trunk/src/series.m
===================================================================
--- trunk/src/series.m	(revision 674)
+++ trunk/src/series.m	(revision 675)
@@ -122,4 +122,5 @@
 series_ResizeFcn(hObject, eventdata, handles)%resize table according to series GUI size
 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display)
+set(handles.InputTable,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function (allow action on uvmat when set_object is in front)
 
 % check default input data
@@ -491,4 +492,24 @@
 
 %------------------------------------------------------------------------
+% --- 'key_press_fcn:' function activated when a key is pressed on the keyboard
+%------------------------------------------------------------------------
+function key_press_fcn(hObject,eventdata,handles)
+
+xx=double(get(handles.series,'CurrentCharacter')); %get the keyboard character
+if ismember(xx,[8 127 31])%backspace or delete, or downward
+    InputTable=get(handles.InputTable,'Data');
+    iline=get(handles.InputTable,'UserData');
+            if isequal(xx, 31)
+                if isequal(iline,size(InputTable,1))% arrow downward
+                InputTable=[InputTable;cell(1,size(InputTable,2))];
+                end
+            else
+    InputTable(iline,:)=[];% suppress the current line 
+            end
+    set(handles.InputTable,'Data',InputTable);
+end
+
+
+%------------------------------------------------------------------------
 % --- Executes on button press in REFRESH.
 function REFRESH_Callback(hObject, eventdata, handles)
@@ -508,5 +529,5 @@
     if ~exist(RootPath,'dir')
         i1_series=[];
-        RootPath=fileparts(RootPath); %will try the upped forlder
+        RootPath=fileparts(RootPath); %will try the upped folder
     else
         [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=...
@@ -526,6 +547,5 @@
 end
 set(handles.REFRESH,'Visible','off')
-set(handles.REFRESH_title,'Visible','off')
-% set(handles.REFRESH,'UserData',[])
+%set(handles.REFRESH_title,'Visible','off')
 
 %------------------------------------------------------------------------
@@ -1447,5 +1467,5 @@
         [tild,msg1]=mkdir(OutputDir);
         if ~strcmp(msg1,'')
-            errormsg=['cannot create ' OutputDir ': ' msg1];%error message for directory creation
+            msgbox_uvmat('ERROR',['cannot create ' OutputDir ': ' msg1]);%error message for directory creation
             return
         end
@@ -1831,16 +1851,4 @@
 set(handles.RUN, 'Value',0)
 
-% %------------------------------------------------------------------------
-% % --- Executes on button press in BIN.
-% function BIN_Callback(hObject, eventdata, handles)
-% %------------------------------------------------------------------------
-%     cmd=['#!/bin/bash \n '...
-%         '#$ -cwd \n '...
-%         'hostname && date \n '...
-%         'umask 002 \n'...
-%         Param.xml.CivmBin ' ' Param.xml.RunTime ' ' filename_xml ' ' OutputFile '.nc'];
-%     
-%------------------------------------------------------------------------
-% --- Main launch command, called by RUN and BATCH
 
 %------------------------------------------------------------------------
@@ -2423,19 +2431,12 @@
 function ViewObject_Callback(hObject, eventdata, handles)
 
-% if get(handles.ViewObject,'Value')
-   % set(handles.EditObject,'Value',0)
-	UserData=get(handles.series,'UserData');
-    hset_object=findobj(allchild(0),'Tag','set_object');
-    if ~isempty(hset_object)
-        delete(hset_object)% refresh set_object if already opened
-    end
-    hset_object=set_object(UserData.ProjObject);
-    set(hset_object,'Name','view_object_series')
-% else
-%     hset_object=findobj(allchild(0),'Tag','set_object');
-%     if ~isempty(hset_object)
-%         delete(hset_object)
-%     end 
-% end
+UserData=get(handles.series,'UserData');
+hset_object=findobj(allchild(0),'Tag','set_object');
+if ~isempty(hset_object)
+    delete(hset_object)% refresh set_object if already opened
+end
+hset_object=set_object(UserData.ProjObject);
+set(hset_object,'Name','view_object_series')
+
 
 %------------------------------------------------------------------------
@@ -2484,10 +2485,10 @@
 
 if get(handles.CheckMask,'Value')
-    MaskData=get(handles.MaskTable,'Data');
     InputTable=get(handles.InputTable,'Data');
     nbview=size(InputTable,1);
-    %     MaskTable=cell(nbview,1);
     MaskTable=cell(nbview,1);%default
     ListMask=cell(nbview,1);%default
+    MaskData=get(handles.MaskTable,'Data');
+    MaskData(size(MaskData,1):nbview,1)=cell(size(MaskData,1):nbview,1);%complement if undefined lines
     for iview=1:nbview
         ListMask{iview,1}=num2str(iview);
@@ -2496,7 +2497,31 @@
             if isempty(MaskData{iview})
                 SubDir=InputTable{iview,2};
-                MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'
-                MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png');
-                if ~exist(MaskName,'file')
+                MaskPath=fullfile(RootPath,[regexprep(SubDir,'\..*','') '.mask']);%take the root part of SubDir, before the first dot '.'
+                if exist(MaskPath,'dir')
+                    ListStruct=dir(MaskPath);%look for a mask file
+                    ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
+                    check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files
+                    ListFiles=ListCells(1,:);%list of file and dri names
+                    ListFiles=ListFiles(~check_dir);%list of file names (excluding dir)
+                    mdetect=0;
+                    if ~isempty(ListFiles)
+                        for ifile=1:numel(ListFiles)
+                            [tild,tild,MaskFile{ifile},i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{ifile},0);
+                            if strcmp(MaskFileType,'image') && isempty(i2_series) && isempty(j2_series)
+                                mdetect=1;
+                                MaskName=ListFiles{ifile};
+                            end
+                            if ~strcmp(MaskFile{ifile},MaskFile{1})
+                                mdetect=0;% cancel detection test in case of multiple masks, use the brower for selection
+                                break
+                            end
+                        end
+                    end
+                    if mdetect==1
+                        MaskName=fullfile(MaskPath,'mask_1.png');
+                    else
+                        MaskName=uigetfile_uvmat('select a mask file:',MaskPath,'image');
+                    end
+                else
                     MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image');
                 end
@@ -2506,7 +2531,5 @@
         end
     end
-    %nbview=size(MaskTable,1);
     set(handles.MaskTable,'Data',MaskTable)
-    %     set(handles.MaskTable,'ColumnFormat',{MaskTable'})
     set(handles.MaskTable,'Visible','on')
     set(handles.MaskBrowse,'Visible','on')
@@ -2524,23 +2547,14 @@
 %------------------------------------------------------------------------
 function MaskBrowse_Callback(hObject, eventdata, handles)
+
 InputTable=get(handles.InputTable,'Data');
 iview=get(handles.ListMask,'Value');
-%     MaskTable=cell(nbview,1);
-
 RootPath=InputTable{iview,1};
-%         if ~isempty(RootPath)
-%         SubDir=InputTable{iview,2};
-%         MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'
-%         MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png');
-%         if ~exist(MaskName,'file')
 MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image');
-%         end
 if ~isempty(MaskName)
     MaskTable=get(handles.MaskTable,'Data');
-MaskTable{iview,1}=MaskName ;
-%         end
-set(handles.MaskTable,'Data',MaskTable)
-end
-   % set(handles.MaskTable,'ColumnFormat',{MaskTable'})
+    MaskTable{iview,1}=MaskName ;
+    set(handles.MaskTable,'Data',MaskTable)
+end
 
 %------------------------------------------------------------------------
@@ -2639,24 +2653,20 @@
 InputTable=get(handles.InputTable,'Data');
 filexml=uigetfile_uvmat('pick a xml parameter file',InputTable{1,1},'.xml');
-% [FileName, PathName] = uigetfile( ...
-%        {'*.xml', ' (*.xml)';
-%        '*.xml',  '.xml files '; ...
-%         '*.*',  'All Files (*.*)'}, ...
-%         'Pick a file',InputTable{1,1});
-% filexml=[PathName FileName];%complete file name 
 if ~isempty(filexml)%abandon if no file is introduced by the browser
     Param=xml2struct(filexml);
     fill_GUI(Param,handles.series)
+    REFRESH_Callback([],[],handles)% refresh data relative to the input files
+    SeriesData=get(handles.series,'UserData');
     if isfield(Param,'ActionInput')
-            set(handles.ActionInput,'Visible','on')
-    set(handles.ActionInput_title,'Visible','on')
-    set(handles.ActionInputView,'Visible','on')
-    set(handles.ActionInputView,'Value',0)
-    %set(handles.ActionInput,'String',ActionName)
-%    ParamOut.ActionInput.Program=ActionName; % record the program in ActionInput
-    SeriesData=get(handles.series,'UserData');
-    SeriesData.ActionInput=Param.ActionInput;
+        set(handles.ActionInput,'Visible','on')
+        set(handles.ActionInput_title,'Visible','on')
+        set(handles.ActionInputView,'Visible','on')
+        set(handles.ActionInputView,'Value',0)
+        SeriesData.ActionInput=Param.ActionInput;
+    end
+    if isfield(Param,'ProjObject')
+        SeriesData.ProjObject=Param.ProjObject;
+    end
     set(handles.series,'UserData',SeriesData)
-    end
     ActionName_Callback([],[],handles)
 end
Index: trunk/src/set_object.m
===================================================================
--- trunk/src/set_object.m	(revision 674)
+++ trunk/src/set_object.m	(revision 675)
@@ -270,4 +270,6 @@
 %------------------------------------------------------------------------
 % --- Executes on selection change in ProjMode.
+%------------------------------------------------------------------------
+
 function ProjMode_Callback(hObject, eventdata, handles)
 menu=get(handles.ProjMode,'String');
@@ -305,10 +307,10 @@
 switch ObjectStyle
     case 'points'
-        set(handles.num_RangeY_2,'TooltipString','num_YMax: range of projection around each point') 
+        set(handles.num_RangeY_2,'TooltipString','num_RangeY_2: range of projection around each point') 
 %         set(handles.XObject,'TooltipString','XObject: set of x coordinates of the points')
 %         set(handles.YObject,'TooltipString','YObject: set of y coordinates of the points')
 %         set(handles.ZObject,'TooltipString','ZObject: set of z coordinates of the points')
     case {'line','polyline','polygon'}
-        set(handles.num_RangeY_2,'TooltipString','num_YMax: range of projection around the line')
+        set(handles.num_RangeY_2,'TooltipString','num_RangeY_2: range of projection around the line')
          set(handles.Coord,'TooltipString','Coord: table of x,y, z coordinates defining the line')
 %         set(handles.YObject,'TooltipString','YObject: set of y coordinates defining the line')
@@ -319,6 +321,6 @@
         end       
     case {'rectangle','ellipse'}
-        set(handles.num_RangeX_2,'TooltipString',['num_XMax: half length of the ' ObjectStyle])
-        set(handles.num_RangeY_2,'TooltipString',['num_YMax: half width of the ' ObjectStyle])
+        set(handles.num_RangeX_2,'TooltipString',['num_RangeX_2: half length of the ' ObjectStyle])
+        set(handles.num_RangeY_2,'TooltipString',['num_RangeY_2: half width of the ' ObjectStyle])
 %         set(handles.XObject,'TooltipString',['XObject:  x coordinate of the ' Type ' centre'])
 %         set(handles.YObject,'TooltipString',['YObject:  y coordinate of the ' Type ' centre'])
@@ -636,25 +638,25 @@
 dir_save=uigetfile_uvmat('select the folder for the new xml object file:',RootPath,'uigetdir');
 if ~isempty(dir_save)
-    % dir_save=uigetdir(RootPath);
     ObjectName=get(handles.Name,'String');
     if ~isempty(ObjectName)&&~strcmp(ObjectName,'')
-        def={fullfile(dir_save,[ObjectName '.xml'])};
+        def=[ObjectName '.xml'];
     else
-        def={fullfile(dir_save,[Object.Style '.xml'])};
-    end
-    displ_txt='save object as an .xml file';%default display
+        def=[Object.Style '.xml'];
+    end
+    displ_txt={'save object as an .xml file in';dir_save};%default display
     menu=get(handles.ProjMode,'String');
     value=get(handles.ProjMode,'Value');
     ProjMode=menu{value};
     if strcmp(ProjMode,'mask_inside')||strcmp(ProjMode,'mask_outside')
-        displ_txt='save mask contour as an .xml file: to create a mask image, use save_mask on the GUI uvmat (lower right)';
-    end
-    answer=msgbox_uvmat('INPUT_TXT','save object as an .xml file',def);
-    if ~isempty(answer)
+        displ_txt={'save mask contour as an .xml file:'; 'to create a mask image, use save_mask on the GUI uvmat (lower right)'};
+    end
+    answer=msgbox_uvmat('INPUT_TXT',displ_txt,def);
+    if iscell(answer)
+        FullName=fullfile(dir_save,answer{1});
         t=struct2xml(Object);
         t=set(t,1,'name','ProjObject');
-        save(t,answer{1})
-    end
-    msgbox_uvmat('CONFIRMATION',[answer{1}  ' saved'])
+        save(t,FullName)
+        msgbox_uvmat('CONFIRMATION',[FullName  ' saved'])
+    end
 end
 
Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 674)
+++ trunk/src/uvmat.m	(revision 675)
@@ -587,5 +587,5 @@
 %------------------------------------------------------------------------
 %refresh the menu of input fieldname
-Fields_Callback(hObject, eventdata, handles);
+FieldName_Callback(hObject, eventdata, handles);
 % refresh the current field view
 run0_Callback(hObject, eventdata, handles); 
@@ -874,5 +874,5 @@
 ColorType='falsecolor'; %default
 UvData.MovieObject{index}=VideoObject;
-if ~isempty(VideoObject)
+if ~isempty(VideoObject)% case of video data
     imainfo=get(VideoObject);
     TimeUnit='s';
@@ -883,5 +883,5 @@
         XmlData.Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate);
     end
-    set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec
+    %set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec
     TimeName='video';
     ColorType='truecolor';
@@ -963,4 +963,8 @@
         (strcmp(FileType,'image')|| strcmp(FileType,'multimage')||strcmp(FileType,'civdata')||strcmp(FileType,'civx'))
     TimeName='xml';
+elseif strcmp(FileType,'civdata')
+    TimeName='civdata';
+elseif strcmp(FileType,'civx')
+    TimeName='civx';
 end
 if index==1
@@ -1041,5 +1045,11 @@
 
 %% update the data attached to the uvmat interface
-UvData.TimeUnit=TimeUnit;
+if ~isempty(TimeUnit)
+    if index==2 && isfield(UvData,'TimeUnit') && ~strcmp(UvData.TimeUnit,TimeUnit)
+        msgbox_uvmat('WARNING',['time unit for second file series ' TimeUnit ' inconsistent with first series'])
+    else
+        UvData.TimeUnit=TimeUnit;
+    end
+end
 UvData.XmlData{index}=XmlData;
 UvData.NewSeries=1;
@@ -1194,5 +1204,7 @@
 %------------------------------------------------------------------------
 %--- update the index display after action on edit boxes i1, i2, j1 or j2
+%------------------------------------------------------------------------
 function update_ij(handles,index_rank)
+    
 NomType=get(handles.NomType,'String');
 indices=get(handles.FileIndex,'String');
@@ -1310,10 +1322,17 @@
         ListFiles=ListFiles(~check_dir);%list of file names (excluding dir)
         if ~isempty(ListFiles)
-            [tild,tild,MaskExt]=fileparts(ListFiles{1});
-            [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{1},0);
-            if strcmp(MaskFileType,'image') && isempty(i2_series) && isempty(j2_series)
-                mdetect=1;
-            end
-        end
+            for ifile=1:numel(ListFiles)
+                [tild,tild,MaskExt]=fileparts(ListFiles{1});
+                [tild,tild,MaskFile{ifile},i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{ifile},0);
+                if strcmp(MaskFileType,'image') && isempty(i2_series) && isempty(j2_series)
+                    mdetect=1;
+                end
+                if ~strcmp(MaskFile{ifile},MaskFile{1})
+                    mdetect=0;% cancel detection test in case of multiple masks, use the brower for selection
+                    break
+                end
+            end
+        end
+        RootPath=MaskPath;
     end
     if mdetect==0
@@ -1536,5 +1555,5 @@
 set(handles.MovieBackward,'BusyAction','Cancel')
 set(handles.MenuExportMovie,'BusyAction','Cancel')
-set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command buttonback to red
+%set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command buttonback to red
 set(handles.Movie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
 set(handles.MovieBackward,'BackgroundColor',[1 0 0])%paint the command buttonback to red
@@ -1556,18 +1575,21 @@
 InputFile.SubDir=regexprep(InputFile.SubDir,'^[\\/]|[\\/]$','');%suppress possible / or \ separator at the beginning or the end of the string
 FileExt=InputFile.FileExt;
-NomType=get(handles.NomType,'String');
-i1=str2num(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name)
-i2=[];%default
-if strcmp(get(handles.i2,'Visible'),'on')
-    i2=str2num(get(handles.i2,'String'));
-end
-j1=[];
-if strcmp(get(handles.j1,'Visible'),'on')
-    j1=stra2num(get(handles.j1,'String'));
-end
-j2=j1;
-if strcmp(get(handles.j2,'Visible'),'on')
-    j2=stra2num(get(handles.j2,'String'));
-end
+NomType=InputFile.NomType;
+%NomType=get(handles.NomType,'String');
+% i1=str2num(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name)
+% i2=[];%default
+% if strcmp(get(handles.i2,'Visible'),'on')
+%     i2=str2num(get(handles.i2,'String'));
+% end
+% j1=[];
+% if strcmp(get(handles.j1,'Visible'),'on')
+%     j1=stra2num(get(handles.j1,'String'));
+% end
+% j2=j1;
+% if strcmp(get(handles.j2,'Visible'),'on')
+%     j2=stra2num(get(handles.j2,'String'));
+% end
+[tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(InputFile.FileIndex);% check back the indices used
+
 sub_value= get(handles.SubField,'Value');
 if sub_value % a second input file has been entered 
@@ -1584,8 +1606,4 @@
 CheckFixPair=get(handles.CheckFixPair,'Value')||(isempty(i2)&&isempty(j2));
 
-%         i1_1=i1;
-%         i2_1=i2;
-%         j1_1=j1;
-%         j2_1=j2;
 % the pair i1-i2 or j1-j2 is imposed (check box CheckFixPair selected)
 if CheckFixPair && isnumeric(increment)
@@ -1596,5 +1614,5 @@
             i1_1=i1_1+increment;
             i2_1=i2_1+increment;
-        end        
+        end
     else % case of scanning along index j (burst numbers)
         j1=j1+increment;
@@ -1606,5 +1624,5 @@
     end
     
-% the pair i1-i2 or j1-j2 is free (check box CheckFixPair not selected): the list of existing indices recorded in UvData is used
+    % the pair i1-i2 or j1-j2 is free (check box CheckFixPair not selected): the list of existing indices recorded in UvData is used
 else
     UvData=get(handles.uvmat,'UserData');
@@ -1677,5 +1695,5 @@
     end
     
-    % case of a second file series 
+    % case of a second file series
     if sub_value
         ref_i_1=i1_1;
@@ -1698,5 +1716,5 @@
         else % free increment, synchronise the ref indices with the first series
             ref_i_1=ref_i;
-            ref_j_1=ref_j; 
+            ref_j_1=ref_j;
         end
         if numel(UvData.i1_series)==1
@@ -1734,5 +1752,5 @@
         if ~isempty(UvData.j2_series{2})
             j2_1=UvData.j2_series{1}(ref_indices(end));
-        end   
+        end
     else% the second series (if needed) is the same file as the first
         i1_1=i1;
@@ -1743,10 +1761,15 @@
 end
 filename=fullfile_uvmat(InputFile.RootPath,InputFile.SubDir,InputFile.RootFile,FileExt,NomType,i1,i2,j1,j2);
+
+%% refresh plots
 if sub_value
     filename_1=fullfile_uvmat(InputFile.RootPath_1,InputFile.SubDir_1,InputFile.RootFile_1,InputFile.FileExt_1,InputFile.NomType_1,i1_1,i2_1,j1_1,j2_1);
+    errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2,i1_1,i2_1,j1_1,j2_1);
+else
+    errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2);
 end
 
 %% refresh plots
-errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2,i1_1,i2_1,j1_1,j2_1);
+% errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2,i1_1,i2_1,j1_1,j2_1);
 
 %% update the index counters if the index move is successfull
@@ -1773,5 +1796,14 @@
         set(handles.movie_pair,'Value',1)
         movie_pair_Callback(hObject, eventdata, handles); %reactivate moviepair if it was activated
-    end
+    else
+        if isempty(i2), set(handles.i2,'String',''); end % suppress the second index display if not used
+        if isempty(j2), set(handles.j2,'String',''); end 
+    end
+    set(handles.i1,'BackgroundColor',[1 1 1])
+    set(handles.i2,'BackgroundColor',[1 1 1])
+    set(handles.j1,'BackgroundColor',[1 1 1])
+    set(handles.j2,'BackgroundColor',[1 1 1])
+    set(handles.FileIndex,'BackgroundColor',[1 1 1])
+    set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 
 end
 
@@ -1786,4 +1818,5 @@
     set(handles.i2,'String','')
     set(handles.j2,'String','')
+    set(handles.Dt_txt,'String','')
     return
 else
@@ -1861,4 +1894,16 @@
 end
 
+%% display time interval for the image pair
+if isfield(UvData,'XmlData')&&isfield(UvData.XmlData{1},'Time')
+    dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1));
+    if  isfield(UvData,'TimeUnit')
+        set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  m' UvData.TimeUnit] )
+    else
+        set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  10^(-3)'] )
+    end
+else
+    set(handles.Dt_txt,'String','')
+end
+
 %% get the first image
 %Field.AName='image';
@@ -1875,50 +1920,4 @@
 end
 [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileType{index},MovieObject,num_frame);
-% Field_b.AX=Field_a.AX;
-% Field_b.AY=Field_a.AY;
-% % z index
-% nbslice=str2double(get(handles.num_NbSlice,'String'));
-% if ~isempty(nbslice)
-%     Field_b.ZIndex=mod(num_i2-1,nbslice)+1;
-% end
-% Field_b.CoordUnit='pixel';
-% 
-% %% determine the input file type
-% if (test_1 && isfield(UvData,'MovieObject')&& numel(UvData.MovieObject>=2))||(~test_1 && ~isempty(UvData.MovieObject{1}))
-%     FileType='movie';
-% elseif isequal(lower(Ext),'.avi')
-%     FileType='avi';
-% elseif isequal(lower(Ext),'.vol')
-%     FileType='vol';
-% else 
-%    form=imformats(Ext(2:end));
-%    if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
-%        if isequal(NomType,'*');
-%            FileType='multimage';
-%        else
-%            FileType='image';
-%        end
-%    end
-% end
-% switch FileType
-%         case 'movie'
-%             if test_1
-%                 Field_b.A=read(UvData.MovieObject{2},num_i2);
-%             else
-%                 Field_b.A=read(UvData.MovieObject{1},num_i2);
-%             end
-%         case 'avi'
-%             mov=aviread(imaname_1,num_i2);
-%             Field_b.A=frame2im(mov(1));
-%         case 'vol'
-%             Field_b.A=imread(imaname_1);
-%         case 'multimage'
-%             Field_b.A=imread(imaname_1,num_i2);
-%         case 'image'
-%             Field_b.A=imread(imaname_1);
-% end 
-% if get(handles.slices,'Value')
-%     Field.ZIndex=str2double(get(handles.z_index,'String'));
-% end
 
 %px to phys or other transform on field
@@ -1933,9 +1932,12 @@
 end
 
- % make movie until movie speed is set to 0 or STOP is activated
+% make movie until movie speed is set to 0 or STOP is activated
 hima=findobj(handles.PlotAxes,'Tag','ima');% %handles.PlotAxes =main plotting window (A GENERALISER)
 set(handles.STOP,'Visible','on')
 set(handles.speed,'Visible','on')
 set(handles.speed_txt,'Visible','on')
+set(handles.i2,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input
+set(handles.j2,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input
+set(handles.FileIndex,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input
 while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue')%isequal(get(handles.run0,'BusyAction'),'queue'); % enable STOP command
     % read and plot the series of images in non erase mode
@@ -1946,5 +1948,6 @@
 end
 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
- set(handles.movie_pair,'Value',0)
+set(handles.movie_pair,'Value',0)
+set(handles.Dt_txt,'String','')
 
 %------------------------------------------------------------------------
@@ -1955,4 +1958,7 @@
 drawnow
 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
+[tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(FileIndex);% check back the indices used
+if isempty(i2), set(handles.i2,'String',''); end % suppress the second index display if not used
+if isempty(j2), set(handles.j2,'String',''); end 
 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
 filename_1='';%default
@@ -1981,5 +1987,5 @@
     set(handles.j2,'BackgroundColor',[1 1 1])
     set(handles.FileIndex,'BackgroundColor',[1 1 1])
-    set(handles.FileIndex_1,'BackgroundColor',[1 1 1])
+    set(handles.FileIndex_1,'BackgroundColor',[1 1 1])   
 end    
 set(handles.run0,'BackgroundColor',[1 0 0])
@@ -1991,9 +1997,9 @@
 %  errormsg: error message char string  =[] by default
 % INPUT:
-% filename: first input file (=[] in the absence of input file)
-% filename_1: second input file (=[] in the asbsenc of secodn input file) 
+% FileName: first input file (=[] in the absence of input file)
+% FileName_1: second input file (=[] in the asbsence of second input file) 
 % num_i1,num_i2,num_j1,num_j2; frame indices
-% Field: structure describing an optional input field (then replace the input file)
-
+% i1_1,i2_1,j1_1,j2_1: frame indices for the second input file  (needed if FileName_1 is not empty)
+%------------------------------------------------------------------------
 function errormsg=refresh_field(handles,FileName,FileName_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1)
 %------------------------------------------------------------------------
@@ -2320,5 +2326,7 @@
 % get time in the input file, not defined in a xml file or movie
 if isempty(abstime)
-    if ~isempty(regexp(TimeName,'^att:'))||~isempty(regexp(TimeName,'^dim:'))||~isempty(regexp(TimeName,'^var:'))
+    if strcmp(TimeName,'civdata')||strcmp(TimeName,'civx')
+        abstime=Field{1}.Time;
+    elseif ~isempty(regexp(TimeName,'^att:'))||~isempty(regexp(TimeName,'^dim:'))||~isempty(regexp(TimeName,'^var:'))
         abstime=Field{1}.(TimeName(5:end));%the time is an attribute or variale selected by get_file
     end
@@ -2362,7 +2370,10 @@
     
     % get time in the input file of the second series, not defined in a xml file or movie
-    if isempty(abstime_1) && numel(Field)==2 &&...
-            ~isempty(regexp(TimeName_1,'^att:')) ||~isempty(regexp(TimeName_1,'^dim:'))||~isempty(regexp(TimeName_1,'^var:'))
+    if isempty(abstime_1) && numel(Field)==2 
+         if strcmp(TimeName_1,'civdata')||strcmp(TimeName_1,'civx')
+        abstime_1=Field{2}.Time;
+         elseif  ~isempty(regexp(TimeName_1,'^att:')) ||~isempty(regexp(TimeName_1,'^dim:'))||~isempty(regexp(TimeName_1,'^var:'))
         abstime_1=Field{2}.(TimeName_1(5:end));%the time is an attribute or variale selected by get_file
+         end
     end
     set(handles.TimeValue_1,'String',num2str(abstime_1,5))
@@ -2806,5 +2817,6 @@
 
 if ~get(handles.CheckFixLimits,'Value')
-    update_plot(handles);
+    update_plot(handles)
+    set(handles.CheckZoom,'Value',0)
 end
 
@@ -3069,5 +3081,12 @@
                 YName={GetFieldData.Coordinates.Coord_y};
                 CName=GetFieldData.PanelVectors.vec_color;
-                [FieldList,VecColorList]=set_field_list(UName,VName,CName);
+                FieldList={['vec(' UName ',' VName ')'];...
+                    ['norm(' UName ',' VName ')'];...
+                    UName;VName};
+                VecColorList={['norm(' UName ',' VName ')'];...
+                    UName;VName};
+                if ~isempty(CName)
+                    VecColorList=[{CName};VecColorList];
+                end
             case 'scalar'
                 AName=GetFieldData.PanelScalar.scalar;
Index: trunk/src/xml2struct.m
===================================================================
--- trunk/src/xml2struct.m	(revision 674)
+++ trunk/src/xml2struct.m	(revision 675)
@@ -48,17 +48,16 @@
     case 'char' 
         out=ss; %reproduce the input string
-        if ~strcmp(ss,'image')% bug with Matlab str2num('image')-> child face
+        % try to convert to number if the char does not correspond to a function (otherwise str2num calls this function as it uses 'eval')
+        if ~isempty(regexp(ss,'^(-*\d+\.*\d*\ *)+$')) || ~isempty(regexp(ss,'\d+e(-|+)\d+')) % if the string corresponds to a set of numbers (with possible sign and decimal, or scientific notation) separated by blanks
             out=str2num(ss);
-            %if isempty(regexp(ss,'^(-*\d+\.*\d*\ *)+$'))% if the string does not contain a set of numbers (with possible sign and decimal) separated by blanks
-            if isempty(out)
-                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
+        else
+            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
         end
