Index: /trunk/src/calc_field.m
===================================================================
--- /trunk/src/calc_field.m	(revision 398)
+++ /trunk/src/calc_field.m	(revision 399)
@@ -1,5 +1,5 @@
 %'calc_field': defines fields (velocity, vort, div...) from civx data and calculate them
 %---------------------------------------------------------------------
-% [DataOut,errormsg]=calc_field(FieldName,DataIn)
+% [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp)
 %
 % OUTPUT:
@@ -16,6 +16,7 @@
 %
 % INPUT:
-% FieldName: string representing the name of the field
+% FieldList: cell array of strings representing the name(s) of the field(s) to calculate
 % DataIn: structure representing the field, as defined in check_field_srtructure.m
+% Coord_interp(:,nb_coord) optional set of coordinates to interpolate the field (use with thin plate shell)
 %
 % FUNCTION related
@@ -23,5 +24,5 @@
 % file, depending on the scalar
 
-function [DataOut,errormsg]=calc_field(FieldName,DataIn,Coord_interp)
+function [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp)
 
 %list of defined scalars to display in menus (in addition to 'ima_cor').
@@ -46,5 +47,5 @@
     'error'}; %error associated to a vector (for stereo or patch)
 errormsg=[]; %default error message
-if ~exist('FieldName','var')
+if ~exist('FieldList','var')
     DataOut=list_field;% gives the list of possible fields in the absence of input
 else
@@ -52,6 +53,6 @@
         DataIn=[];
     end
-    if ischar(FieldName)
-        FieldName={FieldName};%convert a string input to a cell with one string element
+    if ischar(FieldList)
+        FieldList={FieldList};%convert a string input to a cell with one string element
     end
     if isfield(DataIn,'Z')&& isequal(size(DataIn.Z),size(DataIn.X))
@@ -78,39 +79,29 @@
         XMin=min(min(DataIn.SubRange(1,:,:)));
         YMin=min(min(DataIn.SubRange(2,:,:)));
-        %         if ~exist('Coord_interp','var')
-        %             Mesh=sqrt((YMax-YMin)*(XMax-XMin)/numel(DataIn.Coord_tps(:,1,:)));%2D
-        %             xI=XMin:Mesh:XMax;
-        %             yI=YMin:Mesh:YMax;
-        %             [XI,YI]=meshgrid(xI,yI);% interpolation grid
-        %             Coord_interp(:,1)=reshape(XI,[],1);
-        %             Coord_interp(:,2)=reshape(YI,[],1);
-        %             DataOut.coord_y=[yI(1) yI(end)];
-        %             DataOut.coord_x=[xI(1) xI(end)];
-        %      end
         check_der=0;
         check_val=0;
-        for ilist=1:length(FieldName)
-            switch FieldName{ilist}
+        nb_sites=size(Coord_interp,1);
+        nb_coord=size(Coord_interp,2);
+        for ilist=1:length(FieldList)
+            switch FieldList{ilist}
                 case 'velocity'
                     check_val=1;
-                    DataOut.U=zeros(size(Coord_interp,1));
-                    DataOut.V=zeros(size(Coord_interp,1));
+                    DataOut.U=zeros(nb_sites,1);
+                    DataOut.V=zeros(nb_sites,1);
                 case{'vort','div','strain'}% case of spatial derivatives
                     check_der=1;
-                    DataOut.(FieldName{ilist})=zeros(size(Coord_interp,1));
-                otherwise % case of a scalar
-                    check_val=1;
-                    DataOut.(FieldName{ilist})=zeros(size(Coord_interp,1));
-            end
-        end
-        nbval=zeros(size(Coord_interp,1));
+                    DataOut.(FieldList{ilist})=zeros(nb_sites,1);
+%                 otherwise % case of a scalar
+%                     check_val=1;
+%                     DataOut.(FieldList{ilist})=zeros(size(Coord_interp,1));
+            end
+        end
+        nbval=zeros(nb_sites,1);
         NbSubDomain=size(DataIn.SubRange,3);
+        %DataIn.Coord_tps=DataIn.Coord_tps(1:end-3,:,:);% suppress the 3 zeros used to fit with the dimensions of variables
         for isub=1:NbSubDomain
-            if isfield(DataIn,'NbSites')
-                nbvec_sub=DataIn.NbSites(isub);
-            else
-                nbvec_sub=numel(find(DataIn.Indices_tps(:,isub)));
-            end
-            ind_sel=find(Coord_interp>=DataIn.SubRange(:,1,isub) & Coord_interp<=DataIn.SubRange(:,2,isub));
+            nbvec_sub=DataIn.NbSites(isub);
+            check_range=(Coord_interp >=ones(nb_sites,1)*DataIn.SubRange(:,1,isub)' & Coord_interp<=ones(nb_sites,1)*DataIn.SubRange(:,2,isub)');
+            ind_sel=find(sum(check_range,2)==nb_coord);
             %rho smoothing parameter
             %                 epoints = Coord_interp(ind_sel) ;% coordinates of interpolation sites
@@ -118,11 +109,11 @@
             nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap)
             if check_val
-                EM = tps_eval(Coord_interp(ind_sel),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the velocity from tps 'sources'
+                EM = tps_eval(Coord_interp(ind_sel,:),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the velocity from tps 'sources'
             end
             if check_der
-                [EMDX,EMDY] = tps_eval_dxy(Coord_interp(ind_sel),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the spatial derivatives from tps 'sources'
-            end
-            for ilist=1:length(FieldName)
-                switch FieldName{ilist}
+                [EMDX,EMDY] = tps_eval_dxy(Coord_interp(ind_sel,:),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the spatial derivatives from tps 'sources'
+            end
+            for ilist=1:length(FieldList)
+                switch FieldList{ilist}
                     case 'velocity'
                         ListFields={'U', 'V'};
@@ -154,17 +145,17 @@
             end
             DataOut.FF=nbval==0; %put errorflag to 1 for points outside the interpolation rang
-            DataOut.FF=reshape(DataOut.FF,numel(yI),numel(xI));
+%            DataOut.FF=reshape(DataOut.FF,numel(yI),numel(xI));
             nbval(nbval==0)=1;
-            switch FieldName{1}
-                case {'velocity','u','v'}
-                    DataOut.U=reshape(DataOut.U./nbval,numel(yI),numel(xI));
-                    DataOut.V=reshape(DataOut.V./nbval,numel(yI),numel(xI));
-                case 'vort'
-                    DataOut.vort=reshape(DataOut.vort,numel(yI),numel(xI));
-                case 'div'
-                    DataOut.div=reshape(DataOut.div,numel(yI),numel(xI));
-                case 'strain'
-                    DataOut.strain=reshape(DataOut.strain,numel(yI),numel(xI));
-            end
+%             switch FieldList{1}
+%                 case {'velocity','u','v'}
+%                     DataOut.U=reshape(DataOut.U./nbval,numel(yI),numel(xI));
+%                     DataOut.V=reshape(DataOut.V./nbval,numel(yI),numel(xI));
+%                 case 'vort'
+%                     DataOut.vort=reshape(DataOut.vort,numel(yI),numel(xI));
+%                 case 'div'
+%                     DataOut.div=reshape(DataOut.div,numel(yI),numel(xI));
+%                 case 'strain'
+%                     DataOut.strain=reshape(DataOut.strain,numel(yI),numel(xI));
+%             end
             DataOut.ListVarName=[DataOut.ListVarName ListFields];
             for ilist=3:numel(DataOut.ListVarName)
@@ -179,7 +170,7 @@
         %% civx data
         DataOut=DataIn;
-        for ilist=1:length(FieldName)
-            if ~isempty(FieldName{ilist})
-                [VarName,Value,Role,units]=feval(FieldName{ilist},DataIn);%calculate field with appropriate function named FieldName{ilist}
+        for ilist=1:length(FieldList)
+            if ~isempty(FieldList{ilist})
+                [VarName,Value,Role,units]=feval(FieldList{ilist},DataIn);%calculate field with appropriate function named FieldList{ilist}
                 ListVarName=[ListVarName VarName];
                 ValueList=[ValueList Value];
Index: /trunk/src/civ.m
===================================================================
--- /trunk/src/civ.m	(revision 398)
+++ /trunk/src/civ.m	(revision 399)
@@ -1239,6 +1239,8 @@
             end
             Param.Civ1.Time=((time(i2_civ1(ifile)+1,j2_civ1(j)+1)+time(i1_civ1(ifile)+1,j1_civ1(j)+1))/2);
+            if strcmp(CivMode,'CivX')
             Param.Civ1.term_a=num2stra(j1_civ1(j),nom_type_nc);%UTILITE?
             Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);%
+            end
             form=imformats(regexprep(get(handles.ImaExt,'String'),'^.',''));%look for image formats
             if isempty(form)
@@ -1390,6 +1392,8 @@
             end
             Param.Civ2.Time=(time(i2_civ2(ifile)+1,j2_civ2(j)+1)+time(i1_civ2(ifile)+1,j1_civ2(j)+1))/2;
+            if strcmp(CivMode,'CivX')
             Param.Civ2.term_a=num2stra(j1_civ2(j),nom_type_nc);
             Param.Civ2.term_b=num2stra(j2_civ2(j),nom_type_nc);
+            end
             Param.Civ2.filename_nc1=filecell.nc.civ1{ifile,j};
             Param.Civ2.filename_nc1(end-2:end)=[]; % remove '.nc'
Index: /trunk/src/civ_matlab.m
===================================================================
--- /trunk/src/civ_matlab.m	(revision 398)
+++ /trunk/src/civ_matlab.m	(revision 399)
@@ -108,5 +108,5 @@
     Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];% {'Civ1_Time','Civ1_Dt'}];
     Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_F','Civ1_C'};%  cell array containing the names of the fields to record
-    Data.VarDimName={'NbVec1','NbVec1','NbVec1','NbVec1','NbVec1','NbVec1'};
+    Data.VarDimName={'nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1'};
     Data.VarAttribute{1}.Role='coord_x';
     Data.VarAttribute{2}.Role='coord_y';
@@ -159,5 +159,5 @@
     else
         Data.ListVarName=[Data.ListVarName {'Civ1_FF'}];
-        Data.VarDimName=[Data.VarDimName {'NbVec1'}];
+        Data.VarDimName=[Data.VarDimName {'nb_vec_1'}];
         nbvar=length(Data.ListVarName);
         Data.VarAttribute{nbvar}.Role='errorflag';    
@@ -179,6 +179,6 @@
     nbvar=length(Data.ListVarName);
     Data.ListVarName=[Data.ListVarName {'Civ1_U_smooth','Civ1_V_smooth','Civ1_SubRange','Civ1_NbSites','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}];
-    Data.VarDimName=[Data.VarDimName {'NbVec1','NbVec1',{'NbCoord','Two','NbSubDomain1'},{'NbSubDomain1'},...
-             {'NbVec1Sub','NbCoord','NbSubDomain1'},{'Nbtps1','NbSubDomain1'},{'Nbtps1','NbSubDomain1'}}];
+        Data.VarDimName=[Data.VarDimName {'nb_vec_1','nb_vec_1',{'nb_coord','nb_bounds','nb_subdomain_1'},{'nb_subdomain_1'},...
+             {'nb_tps_1','nb_coord','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'}}];
     Data.VarAttribute{nbvar+1}.Role='vector_x';
     Data.VarAttribute{nbvar+2}.Role='vector_y';
@@ -195,6 +195,6 @@
     [Data.Civ1_SubRange,Data.Civ1_NbSites,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,tild,Ures, Vres,tild,FFres]=...
             filter_tps([Data.Civ1_X(ind_good) Data.Civ1_Y(ind_good)],Data.Civ1_U(ind_good),Data.Civ1_V(ind_good),[],Data.Patch1_SubDomain,Data.Patch1_Rho,Data.Patch1_Threshold); 
-%       Data.Civ1_U_Diff(ind_good)=Data.Civ1_U(ind_good)-Ures;
-%       Data.Civ1_V_Diff(ind_good)=Data.Civ1_V(ind_good)-Vres;
+      fill=zeros(3,2,size(Data.Civ1_SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
+      Data.Civ1_Coord_tps=cat(1,Data.Civ1_Coord_tps,fill);
       Data.Civ1_U_smooth(ind_good)=Ures;
       Data.Civ1_V_smooth(ind_good)=Vres;
@@ -305,5 +305,5 @@
     nbvar=numel(Data.ListVarName);
     Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_F','Civ2_C'}];%  cell array containing the names of the fields to record
-    Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2','NbVec2','NbVec2','NbVec2','NbVec2'}];
+    Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2'}];
     Data.VarAttribute{nbvar+1}.Role='coord_x';
     Data.VarAttribute{nbvar+2}.Role='coord_y';
@@ -339,5 +339,5 @@
     else
         Data.ListVarName=[Data.ListVarName {'Civ2_FF'}];
-        Data.VarDimName=[Data.VarDimName {'NbVec2'}];
+        Data.VarDimName=[Data.VarDimName {'nb_vec_2'}];
         nbvar=length(Data.ListVarName);
         Data.VarAttribute{nbvar}.Role='errorflag';    
@@ -356,9 +356,6 @@
     nbvar=length(Data.ListVarName);
     Data.ListVarName=[Data.ListVarName {'Civ2_U_smooth','Civ2_V_smooth','Civ2_SubRange','Civ2_NbSites','Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps'}];
-    Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbCoord','Two','NbSubDomain2'},{'NbSubDomain2'},...
-             {'NbVec2Sub','NbCoord','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'}}];
-%     Data.ListVarName=[Data.ListVarName {'Civ2_U_Diff','Civ2_V_Diff','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_X_tps','Civ2_Y_tps','Civ2_U_tps','Civ2_V_tps','Civ2_Indices_tps'}];
-%     Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbSubDomain2','Two'},{'NbSubDomain2','Two'},...
-%              {'NbVec2Sub','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'}}];
+    Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2',{'nb_coord','nb_bounds','nb_subdomain_2'},{'nb_subdomain_2'},...
+             {'nb_tps_2','nb_coord','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'}}];
 
         Data.VarAttribute{nbvar+1}.Role='vector_x';
@@ -376,4 +373,6 @@
     [Data.Civ2_SubRange,Data.Civ2_NbSites,Data.Civ2_Coord_tps,Data.Civ2_U_tps,Data.Civ2_V_tps,tild,Ures, Vres,tild,FFres]=...
          filter_tps([Data.Civ2_X(ind_good) Data.Civ2_Y(ind_good)],Data.Civ2_U(ind_good),Data.Civ2_V(ind_good),[],Data.Patch2_SubDomain,Data.Patch2_Rho,Data.Patch2_Threshold); 
+           fill=zeros(3,2,size(Data.Civ2_SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
+      Data.Civ2_Coord_tps=cat(1,Data.Civ2_Coord_tps,fill);
     Data.Civ2_U_smooth(ind_good)=Ures;
     Data.Civ2_V_smooth(ind_good)=Vres;
Index: /trunk/src/find_field_indices.m
===================================================================
--- /trunk/src/find_field_indices.m	(revision 398)
+++ /trunk/src/find_field_indices.m	(revision 399)
@@ -58,5 +58,4 @@
 VarDimIndex=[];
 VarDimName={};
-
 if ~isfield(Data,'VarDimName')
     errormsg='missing .VarDimName';
@@ -64,5 +63,5 @@
 end
 
-%loop on the list of variables
+%% loop on the list of variables, group them by common dimensions
 for ivar=1:nbvar
     DimCell=Data.VarDimName{ivar}; %dimensions associated with the variable #ivar
@@ -85,5 +84,5 @@
         CellVarIndex{icell}=ivar;%put the current variabl index in the new cell 
     end
-    
+   
     %look for dimension variables
     if numel(DimCell)==1% if the variable has a single dimension 
@@ -100,7 +99,8 @@
 end
 
-% find the spatial dimensions and vector components 
+%% find the spatial dimensions and vector components 
 ListRole={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','warnflag','errorflag',...
     'ancillary','image','color','discrete','scalar','coord_tps'};
+NbDim=zeros(size(CellVarIndex));%default
 for icell=1:length(CellVarIndex)
     for ilist=1:numel(ListRole)
@@ -142,13 +142,4 @@
         return
     end
-%     if ivar_vector_x>1
-%         ivar_vector_x=ivar_vector_x(1);
-%     end
-%     if ivar_vector_y>1
-%         ivar_vector_y=ivar_vector_y(1);
-%     end
-%     if ivar_vector_z>1
-%         ivar_vector_z=ivar_vector_z(1);
-%     end
     if numel(ivar_errorflag)>1
         errormsg='multiply defined error flag in the same cell';
@@ -159,7 +150,4 @@
         return
     end
-    %NbDim(icell)=0;% nbre of space dimensions 
-%     NbDim(icell)=numel(DimCell);
-    NbDim(icell)=0;
     test_coord=0;
     if numel(VarIndex)>1      
@@ -193,3 +181,20 @@
         NbDim(icell)=2;
     end
+    %look for tps data
+    if ~isempty(VarType{icell}.coord_tps)
+        VarType{icell}.var_tps=[];
+        tps_dimnames=Data.VarDimName{VarType{icell}.coord_tps};
+        if length(tps_dimnames)==3
+            for ilist=1:length(Data.VarDimName)
+                if strcmp(tps_dimnames{1},Data.VarDimName{ilist}{1}) && strcmp(tps_dimnames{3},Data.VarDimName{ilist}{2})% identify the variables corresponding to the tps site coordinates coord_tps
+                    VarType{icell}.var_tps=[VarType{icell}.var_tps ilist];
+                elseif length(Data.VarDimName{ilist})==1 && strcmp(tps_dimnames{3},Data.VarDimName{ilist}{1})% identify the variable corresponding to nbsites
+                    VarType{icell}.nbsites_tps= ilist;
+                elseif length(Data.VarDimName{ilist})==3 && strcmp(tps_dimnames{2},Data.VarDimName{ilist}{1})&& strcmp(tps_dimnames{3},Data.VarDimName{ilist}{3})% identify the variable subrange
+                    VarType{icell}.subrange_tps= ilist;
+                end
+            end
+        end
+        NbDim(icell)=2;
+    end  
 end
Index: /trunk/src/find_file_series.m
===================================================================
--- /trunk/src/find_file_series.m	(revision 398)
+++ /trunk/src/find_file_series.m	(revision 399)
@@ -110,8 +110,9 @@
     if ~isempty(r)
         sep1=r.sep1;
-        if strcmp(lower(r.j1),r.j1)
+        i1_str='(?<i1>\d+)';
+        if strcmp(lower(r.j1),r.j1)% lower case index
             j1_str='(?<j1>[a-z])';
         else
-           j1_str='(?<j1>[A-Z])'; 
+           j1_str='(?<j1>[A-Z])'; % upper case index
         end
         j1_star='*';
Index: /trunk/src/griddata_uvmat.m
===================================================================
--- /trunk/src/griddata_uvmat.m	(revision 398)
+++ /trunk/src/griddata_uvmat.m	(revision 399)
@@ -1,6 +1,6 @@
 %'griddata_uvmat': function griddata_uvmat(vec2_X,vec2_Y,vec2_U,vec_X,vec_Y,'linear')
 %adapt the input of the matlab function griddata to the appropriate version of Matlab
-function ZI = griddata_uvmat(X,Y,Z,XI,YI,rho)
-if ~exist('rho','var')|| isequal(rho,0)
+function ZI = griddata_uvmat(X,Y,Z,XI,YI)
+% if ~exist('rho','var')|| isequal(rho,0)
     txt=ver('MATLAB');
     Release=txt.Release;
@@ -13,15 +13,15 @@
         ZI=griddata(X,Y,Z,XI,YI,'linear');
     end
-else %smooth with thin plate spline
-    [ZI,Z_diff]=patch_uvmat(X,Y,Z,XI,YI,rho);
-    diff_norm=mean(Z_diff.*Z_diff)
-    ind_good=find(abs(Z_diff)<5*diff_norm);
-    nb_remove=numel(Z_diff)-numel(ind_good)
-    if nb_remove>0
-    X=X(ind_good);
-    Y=Y(ind_good);
-    Z=Z(ind_good);
-    [ZI,Z_diff]=patch_uvmat(X,Y,Z,XI,YI,rho);
-    diff_norm_new=mean(Z_diff.*Z_diff)
-    end
-end
+% else %smooth with thin plate spline
+%     [ZI,Z_diff]=patch_uvmat(X,Y,Z,XI,YI,rho);
+%     diff_norm=mean(Z_diff.*Z_diff)
+%     ind_good=find(abs(Z_diff)<5*diff_norm);
+%     nb_remove=numel(Z_diff)-numel(ind_good)
+%     if nb_remove>0
+%     X=X(ind_good);
+%     Y=Y(ind_good);
+%     Z=Z(ind_good);
+%     [ZI,Z_diff]=patch_uvmat(X,Y,Z,XI,YI,rho);
+%     diff_norm_new=mean(Z_diff.*Z_diff)
+%     end
+% end
Index: /trunk/src/mouse_motion.m
===================================================================
--- /trunk/src/mouse_motion.m	(revision 398)
+++ /trunk/src/mouse_motion.m	(revision 399)
@@ -151,5 +151,5 @@
                                     end
                                 end
-                            elseif numel(VarType{icell}.coord) >=2 %structured coordinates
+                            elseif numel(VarType{icell}.coord) >=2 & VarType{icell}.coord > 0 %structured coordinates
                                 yName=Field.ListVarName{VarType{icell}.coord(1)};
                                 xName=Field.ListVarName{VarType{icell}.coord(2)};
Index: /trunk/src/proj_field.m
===================================================================
--- /trunk/src/proj_field.m	(revision 398)
+++ /trunk/src/proj_field.m	(revision 399)
@@ -1,5 +1,5 @@
 %'proj_field': projects the field on a projection object
 %--------------------------------------------------------------------------
-%  function [ProjData,errormsg]=proj_field(FieldData,ObjectData,FieldName)
+%  function [ProjData,errormsg]=proj_field(FieldData,ObjectData)
 %
 % OUTPUT:
@@ -27,5 +27,5 @@
 %FieldData: data of the field to be projected on the projection object, with optional fields
 %    .Txt: error message, transmitted to the projection
-%    .CoordType: 'px' or 'phys' type of coordinates of the field, must be the same as for the projection object, transmitted
+%    .FieldList: cell array of strings representing the fields to calculate
 %    .Mesh: typical distance between data points (used for mouse action or display), transmitted
 %    .CoordUnit, .TimeUnit, .dt: transmitted
@@ -80,5 +80,5 @@
 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 
-function [ProjData,errormsg]=proj_field(FieldData,ObjectData,FieldName)
+function [ProjData,errormsg]=proj_field(FieldData,ObjectData)
 errormsg='';%default
 if ~exist('FieldName','var')
@@ -87,9 +87,5 @@
 %% case of no projection (object is used only as graph display)
 if isfield(ObjectData,'ProjMode') && (isequal(ObjectData.ProjMode,'none')||isequal(ObjectData.ProjMode,'mask_inside')||isequal(ObjectData.ProjMode,'mask_outside'))
-    if ~isempty(FieldName)
-        [ProjData,errormsg]=calc_field(FieldName,FieldData);
-    else
     ProjData=[];
-    end
     return
 end
@@ -143,5 +139,5 @@
         end
     case 'plane'
-            [ProjData,errormsg] = proj_plane(FieldData,ObjectData,FieldName);
+            [ProjData,errormsg] = proj_plane(FieldData,ObjectData);
     case 'volume'
         [ProjData,errormsg] = proj_volume(FieldData,ObjectData);
@@ -892,5 +888,5 @@
 %project on a plane 
 % AJOUTER flux,circul,error
- function  [ProjData,errormsg] = proj_plane(FieldData, ObjectData,FieldName)
+ function  [ProjData,errormsg] = proj_plane(FieldData, ObjectData)
 %-----------------------------------------------------------------
 
@@ -994,5 +990,5 @@
 % CellVarIndex=cells of variable index arrays
 ivar_new=0; % index of the current variable in the projected field
-icoord=0;
+% icoord=0;
 nbcoord=0;%number of added coordinate variables brought by projection
 nbvar=0;
@@ -1000,5 +996,5 @@
     NbDim=NbDimVec(icell);
     if NbDim<2
-        continue
+        continue % only cells represnting 2D or 3D fields are involved
     end
     VarIndex=CellVarIndex{icell};%  indices of the selected variables in the list FieldData.ListVarName
@@ -1010,5 +1006,5 @@
     ivar_V=VarType.vector_y;
     ivar_W=VarType.vector_z;
-    ivar_C=VarType.scalar ;
+    %    ivar_C=VarType.scalar ;
     ivar_Anc=VarType.ancillary;
     test_anc=zeros(size(VarIndex));
@@ -1016,5 +1012,5 @@
     ivar_F=VarType.warnflag;
     ivar_FF=VarType.errorflag;
-    testX=~isempty(ivar_X) && ~isempty(ivar_Y);
+    check_unstructured_coord=(~isempty(ivar_X) && ~isempty(ivar_Y))||~isempty(VarType.coord_tps);
     DimCell=FieldData.VarDimName{VarIndex(1)};
     if ischar(DimCell)
@@ -1024,148 +1020,138 @@
     %% case of input fields with unstructured coordinates
     coord_z=0;%default
-    if testX
-        XName=FieldData.ListVarName{ivar_X};
-        YName=FieldData.ListVarName{ivar_Y};
-        coord_x=FieldData.(XName);
-        coord_y=FieldData.(YName);
-        if length(ivar_Z)==1
-            ZName=FieldData.ListVarName{ivar_Z};
-            coord_z=FieldData.(ZName);
-        end
-        
-        % translate  initial coordinates
-        coord_x=coord_x-ObjectData.Coord(1,1);
-        coord_y=coord_y-ObjectData.Coord(1,2);
-        if ~isempty(ivar_Z)
-            coord_z=coord_z-ObjectData.Coord(1,3);
-        end
-        
-        % selection of the vectors in the projection range (3D case)
-        if length(ivar_Z)==1 &&  width > 0
-            %components of the unitiy vector normal to the projection plane
-            fieldZ=norm_plane(1)*coord_x + norm_plane(2)*coord_y+ norm_plane(3)*coord_z;% distance to the plane
-            indcut=find(abs(fieldZ) <= width);
-            size(indcut)
-            for ivar=VarIndex
-                VarName=FieldData.ListVarName{ivar};
-                eval(['FieldData.' VarName '=FieldData.' VarName '(indcut);'])
-                % A VOIR : CAS DE VAR STRUCTUREE MAIS PAS GRILLE REGULIERE : INTERPOLER SUR GRILLE REGULIERE
-            end
-            coord_x=coord_x(indcut);
-            coord_y=coord_y(indcut);
-            coord_z=coord_z(indcut);
-        end
-        
-        %rotate coordinates if needed: 
-        Psi=PlaneAngle(1);
-        Theta=PlaneAngle(2);
-        Phi=PlaneAngle(3);
-        if testangle && ~test90y && ~test90x;%=1 for slanted plane
-            coord_X=(coord_x *cos(Phi) + coord_y* sin(Phi));
-            coord_Y=(-coord_x *sin(Phi) + coord_y *cos(Phi))*cos(Theta);
-            coord_Y=coord_Y+coord_z *sin(Theta);
-            coord_X=(coord_X *cos(Psi) - coord_Y* sin(Psi));%A VERIFIER
-
-            coord_Y=(coord_X *sin(Psi) + coord_Y* cos(Psi));
-        else
-            coord_X=coord_x;
-            coord_Y=coord_y;
-        end
-        
-        %restriction to the range of x and y if imposed
-        testin=ones(size(coord_X)); %default
-        testbound=0;
-        if testXMin
-            testin=testin & (coord_X >= XMin);
-            testbound=1;
-        end
-        if testXMax
-            testin=testin & (coord_X <= XMax);
-            testbound=1;
-        end
-        if testYMin
-            testin=testin & (coord_Y >= YMin);
-            testbound=1;
-        end
-        if testYMin
-            testin=testin & (coord_Y <= YMax);
-            testbound=1;
-        end
-        if testbound
-            indcut=find(testin);
-            for ivar=VarIndex
-                VarName=FieldData.ListVarName{ivar};
-                eval(['FieldData.' VarName '=FieldData.' VarName '(indcut);'])
-            end
-            coord_X=coord_X(indcut);
-            coord_Y=coord_Y(indcut);
+    if check_unstructured_coord
+        if ~isempty(ivar_X)% case of tps excluded. TODO similar procedure
+            XName=FieldData.ListVarName{ivar_X};
+            YName=FieldData.ListVarName{ivar_Y};
+            coord_x=FieldData.(XName);
+            coord_y=FieldData.(YName);
             if length(ivar_Z)==1
-                coord_Z=coord_Z(indcut);
+                ZName=FieldData.ListVarName{ivar_Z};
+                coord_z=FieldData.(ZName);
+            end
+            
+            % translate  initial coordinates
+            coord_x=coord_x-ObjectData.Coord(1,1);
+            coord_y=coord_y-ObjectData.Coord(1,2);
+            if ~isempty(ivar_Z)
+                coord_z=coord_z-ObjectData.Coord(1,3);
+            end
+            
+            % selection of the vectors in the projection range (3D case)
+            if length(ivar_Z)==1 &&  width > 0
+                %components of the unitiy vector normal to the projection plane
+                fieldZ=norm_plane(1)*coord_x + norm_plane(2)*coord_y+ norm_plane(3)*coord_z;% distance to the plane
+                indcut=find(abs(fieldZ) <= width);
+                size(indcut)
+                for ivar=VarIndex
+                    VarName=FieldData.ListVarName{ivar};
+                    eval(['FieldData.' VarName '=FieldData.' VarName '(indcut);'])
+                    % A VOIR : CAS DE VAR STRUCTUREE MAIS PAS GRILLE REGULIERE : INTERPOLER SUR GRILLE REGULIERE
+                end
+                coord_x=coord_x(indcut);
+                coord_y=coord_y(indcut);
+                coord_z=coord_z(indcut);
+            end
+            
+            %rotate coordinates if needed:
+            Psi=PlaneAngle(1);
+            Theta=PlaneAngle(2);
+            Phi=PlaneAngle(3);
+            if testangle && ~test90y && ~test90x;%=1 for slanted plane
+                coord_X=(coord_x *cos(Phi) + coord_y* sin(Phi));
+                coord_Y=(-coord_x *sin(Phi) + coord_y *cos(Phi))*cos(Theta);
+                coord_Y=coord_Y+coord_z *sin(Theta);
+                coord_X=(coord_X *cos(Psi) - coord_Y* sin(Psi));%A VERIFIER
+                
+                coord_Y=(coord_X *sin(Psi) + coord_Y* cos(Psi));
+            else
+                coord_X=coord_x;
+                coord_Y=coord_y;
+            end
+            
+            %restriction to the range of x and y if imposed
+            testin=ones(size(coord_X)); %default
+            testbound=0;
+            if testXMin
+                testin=testin & (coord_X >= XMin);
+                testbound=1;
+            end
+            if testXMax
+                testin=testin & (coord_X <= XMax);
+                testbound=1;
+            end
+            if testYMin
+                testin=testin & (coord_Y >= YMin);
+                testbound=1;
+            end
+            if testYMin
+                testin=testin & (coord_Y <= YMax);
+                testbound=1;
+            end
+            if testbound
+                indcut=find(testin);
+                for ivar=VarIndex
+                    VarName=FieldData.ListVarName{ivar};
+                    eval(['FieldData.' VarName '=FieldData.' VarName '(indcut);'])
+                end
+                coord_X=coord_X(indcut);
+                coord_Y=coord_Y(indcut);
+                if length(ivar_Z)==1
+                    coord_Z=coord_Z(indcut);
+                end
             end
         end
         % different cases of projection
-        if isequal(ObjectData.ProjMode,'projection')
-            %the list of dimension
-            %ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions
-            %ProjData.DimValue=[ProjData.
-            %length(coord_X)];
-            
-            for ivar=VarIndex %transfer variables to the projection plane
-                VarName=FieldData.ListVarName{ivar};
-                if ivar==ivar_X %x coordinate
-                    eval(['ProjData.' VarName '=coord_X;'])
-                elseif ivar==ivar_Y % y coordinate
-                    eval(['ProjData.' VarName '=coord_Y;'])
-                elseif isempty(ivar_Z) || ivar~=ivar_Z % other variables (except Z coordinate wyhich is not reproduced)
-                    eval(['ProjData.' VarName '=FieldData.' VarName ';'])
-                end
-                if isempty(ivar_Z) || ivar~=ivar_Z
-                    ProjData.ListVarName=[ProjData.ListVarName VarName];
-                    ProjData.VarDimName=[ProjData.VarDimName DimCell];
-                    nbvar=nbvar+1;
-                    if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute) >=ivar
-                        ProjData.VarAttribute{nbvar}=FieldData.VarAttribute{ivar};
-                    end
-                end
-            end
-        elseif isequal(ObjectData.ProjMode,'interp')||isequal(ObjectData.ProjMode,'filter')%interpolate data on a regular grid
-            if isequal(ObjectData.ProjMode,'filter')
-                rho=1000;%smoothing parameter, (small for strong smoothing)
-            else
-                rho=0;
-            end
-            coord_x_proj=XMin:DX:XMax;
-            coord_y_proj=YMin:DY:YMax;
-            if isfield(FieldData,[VarName '_tps'])
-                [XI,YI]=meshgrid(coord_x_proj,coord_y_proj');
-                XI=reshape(XI,[],1);
-                YI=reshape(YI,[],1);         
-            end
-            DimCell={'coord_y','coord_x'};
-            ProjData.ListVarName={'coord_y','coord_x'};
-            ProjData.VarDimName={'coord_y','coord_x'};
-            nbcoord=2;
-            ProjData.coord_y=[YMin YMax];
-            ProjData.coord_x=[XMin XMax];
-            if isempty(ivar_X), ivar_X=0; end;
-            if isempty(ivar_Y), ivar_Y=0; end;
-            if isempty(ivar_Z), ivar_Z=0; end;
-            if isempty(ivar_U), ivar_U=0; end;
-            if isempty(ivar_V), ivar_V=0; end;
-            if isempty(ivar_W), ivar_W=0; end;
-            if isempty(ivar_F), ivar_F=0; end;
-            if isempty(ivar_FF), ivar_FF=0; end;
-            if ~isequal(ivar_FF,0)
-                VarName_FF=FieldData.ListVarName{ivar_FF};
-                eval(['indsel=find(FieldData.' VarName_FF '==0);'])
-                coord_X=coord_X(indsel);
-                coord_Y=coord_Y(indsel);
-            end
-            FF=zeros(1,length(coord_y_proj)*length(coord_x_proj));
-            testFF=0;
-            FieldName
-            if ~isempty(FieldName)
-                ProjData=calc_field(FieldName,FieldData,[XI YI]);
-            else
+        switch ObjectData.ProjMode
+            case 'projection'
+                %the list of dimension
+                %ProjData.ListDimName=[ProjData.ListDimName FieldData.VarDimName(VarIndex(1))];%add the point index to the list of dimensions
+                %ProjData.DimValue=[ProjData.
+                %length(coord_X)];
+                
+                for ivar=VarIndex %transfer variables to the projection plane
+                    VarName=FieldData.ListVarName{ivar};
+                    if ivar==ivar_X %x coordinate
+                        eval(['ProjData.' VarName '=coord_X;'])
+                    elseif ivar==ivar_Y % y coordinate
+                        eval(['ProjData.' VarName '=coord_Y;'])
+                    elseif isempty(ivar_Z) || ivar~=ivar_Z % other variables (except Z coordinate wyhich is not reproduced)
+                        eval(['ProjData.' VarName '=FieldData.' VarName ';'])
+                    end
+                    if isempty(ivar_Z) || ivar~=ivar_Z
+                        ProjData.ListVarName=[ProjData.ListVarName VarName];
+                        ProjData.VarDimName=[ProjData.VarDimName DimCell];
+                        nbvar=nbvar+1;
+                        if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute) >=ivar
+                            ProjData.VarAttribute{nbvar}=FieldData.VarAttribute{ivar};
+                        end
+                    end
+                end
+            case 'interp'%interpolate data on a regular grid
+                coord_x_proj=XMin:DX:XMax;
+                coord_y_proj=YMin:DY:YMax;
+                DimCell={'coord_y','coord_x'};
+                ProjData.ListVarName={'coord_y','coord_x'};
+                ProjData.VarDimName={'coord_y','coord_x'};
+                nbcoord=2;
+                ProjData.coord_y=[YMin YMax];
+                ProjData.coord_x=[XMin XMax];
+                if isempty(ivar_X), ivar_X=0; end;
+                if isempty(ivar_Y), ivar_Y=0; end;
+                if isempty(ivar_Z), ivar_Z=0; end;
+                if isempty(ivar_U), ivar_U=0; end;
+                if isempty(ivar_V), ivar_V=0; end;
+                if isempty(ivar_W), ivar_W=0; end;
+                if isempty(ivar_F), ivar_F=0; end;
+                if isempty(ivar_FF), ivar_FF=0; end;
+                if ~isequal(ivar_FF,0)
+                    VarName_FF=FieldData.ListVarName{ivar_FF};
+                    eval(['indsel=find(FieldData.' VarName_FF '==0);'])
+                    coord_X=coord_X(indsel);
+                    coord_Y=coord_Y(indsel);
+                end
+                
+                FF=zeros(1,length(coord_y_proj)*length(coord_x_proj));
+                testFF=0;
                 for ivar=VarIndex
                     VarName=FieldData.ListVarName{ivar};
@@ -1180,10 +1166,5 @@
                             FieldData.(VarName)=FieldData.(VarName)(indsel);
                         end
-                        %                     if isfield(FieldData,[VarName '_tps'])
-                        %                         [XI,YI]=meshgrid(coord_x_proj,coord_y_proj');
-                        %                         XI=reshape(XI,[],1);
-                        %                         YI=reshape(YI,[],1);
-                        %
-                        ProjData.(VarName)=griddata_uvmat(double(coord_X),double(coord_Y),double(FieldData.(VarName)),coord_x_proj,coord_y_proj',rho);
+                        ProjData.(VarName)=griddata_uvmat(double(coord_X),double(coord_Y),double(FieldData.(VarName)),coord_x_proj,coord_y_proj');
                         varline=reshape(ProjData.(VarName),1,length(coord_y_proj)*length(coord_x_proj));
                         FFlag= isnan(varline); %detect undefined values NaN
@@ -1212,7 +1193,23 @@
                     ProjData.VarAttribute{ivar_new+1+nbcoord}.Role='errorflag';
                 end
-            end
-        end
-        
+            case 'filter'
+                if ~isempty(VarType.coord_tps)
+                    VarType.coord_tps
+                    coord_x_proj=XMin:DX:XMax;
+                    coord_y_proj=YMin:DY:YMax;
+                    np_x=numel(coord_x_proj);
+                    np_y=numel(coord_y_proj);
+                    [XI,YI]=meshgrid(coord_x_proj,coord_y_proj');
+                    XI=reshape(XI,[],1);
+                    YI=reshape(YI,[],1);
+                    ProjData=calc_field(FieldData.FieldList,FieldData,[XI YI]);
+                    for ilist=3:length(ProjData.ListVarName)% reshape data, excluding coordinates (ilist=1-2), TODO: rationalise
+                        VarName=ProjData.ListVarName{ilist};
+                        ProjData.(VarName)=reshape(ProjData.(VarName),np_y,np_x);
+                    end
+                    ProjData.coord_x=[XMin XMax];
+                    ProjData.coord_y=[YMin YMax];
+                end
+        end
         %% case of input fields defined on a structured  grid
     else
@@ -1352,5 +1349,5 @@
         % case with no  interpolation
         if isequal(ProjMode,'projection') && (~testangle || test90y || test90x)
-            if  NbDim==2 && ~testXMin && ~testXMax && ~testYMin && ~testYMax 
+            if  NbDim==2 && ~testXMin && ~testXMax && ~testYMin && ~testYMax
                 ProjData=FieldData;% no change by projection
             else
@@ -1375,14 +1372,14 @@
                     min_indx=ceil((Coord{NbDim}(1)-XMax)/DXinit)+1;
                     max_indx=floor((Coord{NbDim}(1)-XMin)/DXinit)+1;
-                    Xbound(2)=Coord{NbDim}(1)+DXinit*(max_indx-1);                         
+                    Xbound(2)=Coord{NbDim}(1)+DXinit*(max_indx-1);
                     Xbound(1)=Coord{NbDim}(1)+DXinit*(min_indx-1);
                 end
                 min_indy=max(min_indy,1);% deals with margin (bound lower than the first index)
                 min_indx=max(min_indx,1);
-
+                
                 if test90y
                     ind_new=[3 2 1];
                     DimCell={AYProjName,AXProjName};
-%                     DimValue=DimValue(ind_new);
+                    %                     DimValue=DimValue(ind_new);
                     iz=ceil((ObjectData.Coord(1,1)-Coord{3}(1))/DX)+1;
                     for ivar=VarIndex
@@ -1656,5 +1653,5 @@
     ivar_F=VarType.warnflag;
     ivar_FF=VarType.errorflag;
-    testX=~isempty(ivar_X) && ~isempty(ivar_Y);
+    check_unstructured_coord=~isempty(ivar_X) && ~isempty(ivar_Y);
     DimCell=FieldData.VarDimName{VarIndex(1)};
     if ischar(DimCell)
@@ -1663,5 +1660,5 @@
 
 %% case of input fields with unstructured coordinates
-    if testX
+    if check_unstructured_coord
         XName=FieldData.ListVarName{ivar_X};
         YName=FieldData.ListVarName{ivar_Y};
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 398)
+++ /trunk/src/series.m	(revision 399)
@@ -1054,5 +1054,5 @@
 if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series)
     if isequal(mode,'series(Di)') 
-        find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
+        find_netcpair_civ(handles);% update the menu of pairs depending on the available netcdf files
     end
 end
@@ -1069,5 +1069,5 @@
 if ~isempty(SeriesData.i2_series)||~isempty(SeriesData.j2_series)
     if isequal(mode,'series(Di)') 
-        find_netcpair_civ(handles,Val);% update the menu of pairs depending on the available netcdf files
+        find_netcpair_civ(handles);% update the menu of pairs depending on the available netcdf files
     end
 end
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 398)
+++ /trunk/src/uvmat.m	(revision 399)
@@ -310,5 +310,4 @@
         end
         if isfield(input,'FieldsString')
-%             set(handles.Fields,'Value',1)
             UvData.FieldsString=input.FieldsString;
         end
@@ -486,5 +485,5 @@
     handles_NomType=handles.NomType;
     handles_FileExt=handles.FileExt;
-    handles_Fields=handles.Fields;
+%     handles_Fields=handles.Fields;
 elseif index==2
     handles_RootPath=handles.RootPath_1;
@@ -494,5 +493,5 @@
     handles_NomType=handles.NomType_1;
     handles_FileExt=handles.FileExt_1;
-    handles_Fields=handles.Fields_1;
+%     handles_Fields=handles.Fields_1;
     set(handles.RootPath_1,'Visible','on')
     set(handles.RootFile_1,'Visible','on')
@@ -504,15 +503,8 @@
 
 %% detect root name, nomenclature and indices in the input file name:
-%[RootPath,SubDir]=fileparts_uvmat(fileinput);
 [FilePath,FileName,FileExt]=fileparts(fileinput);
 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
-% if strcmp(NomType,'*')% movies will be opened at the first frame
-%     i1=1;
-%     i2=[];
-%     j1=[];
-%     j2=[];
-% end  
 
 %% open the file or fill the GUI uvmat according to the detected file type
@@ -1964,5 +1956,5 @@
     FieldName=[];%default
     VelType=[];%default
-    FileExt=get(handles.FileExt,'String');
+   % FileExt=get(handles.FileExt,'String');
     FileType=UvData.FileType{1};
     switch FileType
@@ -2234,4 +2226,5 @@
    UvData.Field=Field{1};
 end
+UvData.Field.FieldList={FieldName}; % TODO: to generalise, used for proj_field with tps interpolation
 
 %% get bounds and mesh (needed for mouse action and to open set_object)
@@ -3818,5 +3811,5 @@
 AxeData=UvData.axes3;% retrieve the current plotted data
 PlotParam=read_GUI(handles.uvmat);
-[PP,PlotParamOut]= plot_field(AxeData,handles.axes3,PlotParam);
+[tild,PlotParamOut]= plot_field(AxeData,handles.axes3,PlotParam);
 write_plot_param(handles,PlotParamOut); %update the auto plot parameters
 
@@ -3826,6 +3819,5 @@
 %-------------------------------------------------------------------
 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 
-test=get(handles.edit_object,'Value');
-if test
+if get(handles.edit_object,'Value')
     set(handles.edit_object,'BackgroundColor',[1,1,0])  
     %suppress the other options 
@@ -3838,16 +3830,18 @@
         set(hhgeometry_calib.edit_append,'BackgroundColor',[0.7 0.7 0.7])
     end
+    hset_object=findobj(allchild(0),'Tag','set_object');
+    if isempty(hset_object)% open the GUI set_object with data of the currently selected object
+        ViewObject_Callback(hObject, eventdata, handles)
+        hset_object=findobj(allchild(0),'Tag','set_object');
+    end
+    hhset_object=guidata(hset_object);
+    set(hhset_object.PLOT,'enable','on');
 else 
     UvData.MouseAction='none';
-    set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])   
-end
-set(handles.uvmat,'UserData',UvData);
-hset_object=findobj(allchild(0),'Tag','set_object');
-if ~isempty(hset_object)
-    hhset_object=guidata(hset_object);
-    if test
-        set(hhset_object.PLOT,'enable','on');
-    else
-       set(hhset_object.PLOT,'enable','off'); 
+    set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])  
+    hset_object=findobj(allchild(0),'Tag','set_object');
+    if ~isempty(hset_object)% open the 
+        hhset_object=guidata(hset_object);
+        set(hhset_object.PLOT,'enable','off'); 
     end
 end
@@ -4567,6 +4561,8 @@
 end
 
+%------------------------------------------------------------------------
 % --- Executes on button press in ViewObject.
 function ViewObject_Callback(hObject, eventdata, handles)
+%------------------------------------------------------------------------
 IndexObj=get(handles.ListObject,'Value');
 IndexObj=IndexObj(end); %keeps only the secodn value
