Index: /trunk/src/calc_field.m
===================================================================
--- /trunk/src/calc_field.m	(revision 574)
+++ /trunk/src/calc_field.m	(revision 575)
@@ -1,3 +1,3 @@
-%'calc_field': defines fields (velocity, vort, div...) from civx data and calculate them
+%'calc_field': defines fields (velocity, vort, div...) from civx data (old conventions) and calculate them.
 %---------------------------------------------------------------------
 % [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp)
@@ -121,18 +121,19 @@
         XMin=min(XMin);
         YMin=min(YMin);
-        if ~isfield(DataIn,'Mesh')
-            DataIn.Mesh=sqrt(2*(XMax-XMin)*(YMax-YMin)/numel(DataIn.Coord_tps));
+        if ~isfield(DataIn,'CoordMesh')
+            DataIn.Coord
+            Mesh=sqrt(2*(XMax-XMin)*(YMax-YMin)/numel(DataIn.Coord_tps));
             % adjust the mesh to a value 1, 2 , 5 *10^n
-            ord=10^(floor(log10(DataIn.Mesh)));%order of magnitude
-            if DataIn.Mesh/ord>=5
-                DataIn.Mesh=5*ord;
-            elseif DataIn.Mesh/ord>=2
-                DataIn.Mesh=2*ord;
+            ord=10^(floor(log10(DataIn.CoordMesh)));%order of magnitude
+            if DataIn.CoordMesh/ord>=5
+                DataIn.CoordMesh=5*ord;
+            elseif DataIn.CoordMesh/ord>=2
+                DataIn.CoordMesh=2*ord;
             else
-                DataIn.Mesh=ord;
+                DataIn.CoordMesh=ord;
             end
         end
-        coord_x=XMin:DataIn.Mesh:XMax;% increase the recommanded mesh to  visualisation
-        coord_y=YMin:DataIn.Mesh:YMax;
+        coord_x=XMin:DataIn.CoordMesh:XMax;% increase the recommanded mesh to  visualisation
+        coord_y=YMin:DataIn.CoordMesh:YMax;
         DataOut.coord_x=[XMin XMax];
         DataOut.coord_y=[YMin YMax];
Index: /trunk/src/calc_field_interp.m
===================================================================
--- /trunk/src/calc_field_interp.m	(revision 574)
+++ /trunk/src/calc_field_interp.m	(revision 575)
@@ -1,9 +1,9 @@
-
-%'calc_field': defines fields (velocity, vort, div...) from civ data and calculate them
+%'calc_field_interp': defines fields (velocity, vort, div...) from civ data and calculate them
+% for projection with linear interpolation
 %---------------------------------------------------------------------
 % [DataOut,VarAttribute,errormsg]=calc_field_interp(Coord_tps,NbSites,SubRange,FieldVar,Operation,Coord_interp)
 %
 % OUTPUT:
-% DataOut: structure representing the output fields
+% VarVal: array giving the values of the calculated field
 %
 % INPUT:
Index: /trunk/src/calc_field_tps.m
===================================================================
--- /trunk/src/calc_field_tps.m	(revision 574)
+++ /trunk/src/calc_field_tps.m	(revision 575)
@@ -1,4 +1,4 @@
 
-%'calc_field': defines fields (velocity, vort, div...) from civx data and calculate them
+%'calc_field_tps': defines fields (velocity, vort, div...) from civ data and calculate them with tps interpolation
 %---------------------------------------------------------------------
 % [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord_tps,NbSites,SubRange,FieldVar,Operation,Coord_interp)
Index: /trunk/src/civ.m
===================================================================
--- /trunk/src/civ.m	(revision 574)
+++ /trunk/src/civ.m	(revision 575)
@@ -1418,9 +1418,12 @@
                 switch oar_modes{S}
                     case 'oar-parexec' %oar-dispatch.pl
+                        if strcmp(Param.Program,'civ_matlab')
+                            ncores=1;
+                            msgbox_uvmat('WARNING','Number of cores =1: select the compiled version civ_matlab.sh for multi-core processing');
+                        else
                         answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''});
                         ncores=str2double(answer{1});
-                        if strcmp(Param.Program,'civ_matlab')
-                            ncores=1;
                         end
+
                         extra_oar=answer{2};
                         walltime_onejob=600;%seconds
Index: /trunk/src/civ_matlab.m
===================================================================
--- /trunk/src/civ_matlab.m	(revision 574)
+++ /trunk/src/civ_matlab.m	(revision 575)
@@ -1,3 +1,3 @@
-%'civ_matlab': Matlab version of the PIV programs CivX
+%'civ_matlab': main PIV function, calleed by the GUI civ
 % --- call the sub-functions:
 %   civ: PIV function itself
Index: /trunk/src/fileparts_uvmat.m
===================================================================
--- /trunk/src/fileparts_uvmat.m	(revision 574)
+++ /trunk/src/fileparts_uvmat.m	(revision 575)
@@ -1,3 +1,3 @@
-%'fileparts_uvmat': Splits a file name and recognize file naming convention
+%'fileparts_uvmat': splits a file name in root and indices and recognize file naming convention
 %--------------------------------------------------------------------
 %[RootPath,SubDir,RootFile,i1,i2,j1,j2,Ext,NomType]=fileparts_uvmat(FileInput)
Index: /trunk/src/find_field_cells.m
===================================================================
--- /trunk/src/find_field_cells.m	(revision 574)
+++ /trunk/src/find_field_cells.m	(revision 575)
@@ -1,3 +1,3 @@
-%'find_file_indices': test field structure for input in proj_field and plot_field
+%'find_field_cells': test field structure for input in proj_field and plot_field
 %    group the variables  into 'fields' with common dimensions
 %------------------------------------------------------------------------
@@ -27,4 +27,5 @@
 % INPUT:
 % Data: structure representing fields, output of check_field_structure
+%            .ListGlobalAttributes
 %            .ListVarName: cell array listing the names (cahr strings) of the variables
 %            .VarDimName: cell array of cells containing the set of dimension names for each variable of .ListVarName
@@ -32,5 +33,10 @@
 %                     .VarAttribute{ilist}.key=value, where ilist is the variable
 %                     index, key is the name of the attribute, value its value (char string or number)
-%
+%            .Attr1, .Attr2....
+%        case of actual data:
+%            .Var1, .Var2...
+%        case of data structure, without the  data themselves
+%            .LisDimName: list of dimension names
+%            .DimValue: list of corresponding dimension values
 % HELP: 
 % to get the dimensions of arrays common to the field #icell
@@ -104,5 +110,6 @@
 ivar_coord_x=find(strcmp('coord_x',Role));
 % VarDimCell=cell(numel(ivar_coord_x));
-check_select=zeros(1,nbvar);
+check_select=false(1,nbvar);
+check_coord=false(1,nbvar);
 CellInfo=cell(1,numel(ivar_coord_x));
 NbDim=zeros(1,numel(ivar_coord_x));
@@ -197,5 +204,6 @@
 ListVarName=Data.ListVarName(~check_select);%list of remaining variables
 VarDimName=Data.VarDimName(~check_select);%dimensions of remaining variables
-check_coord= cellfun(@numel,VarDimName)==1|cellfun(@ischar,VarDimName)==1;% find remaining variables with a single dimension
+check_coord_select= cellfun(@numel,VarDimName)==1|cellfun(@ischar,VarDimName)==1;% find remaining variables with a single dimension
+check_coord(~check_select)=check_coord_select;
 ListCoordIndex=ivar_remain(check_coord);% indices of remaining variables with a single dimension
 ListCoordName=Data.ListVarName(ListCoordIndex);% corresponding names of remaining variables with a single dimension
Index: unk/src/find_field_cells_new.m
===================================================================
--- /trunk/src/find_field_cells_new.m	(revision 574)
+++ 	(revision )
@@ -1,271 +1,0 @@
-%'find_file_indices': test field structure for input in proj_field and plot_field
-%    group the variables  into 'fields' with common dimensions
-%------------------------------------------------------------------------
-% function  [CellVarIndex,NbDim,CoordType,VarRole,errormsg]=find_field_cells(Data)=find_field_cells(Data)
-%
-% OUTPUT:
-% CellVaxIndex: cell whose elements are arrays of the variable indices in the list Data.ListVarName for each field cell   
-%              CellvarIndex{i} represents a set of variables with the same dimensions
-% NbDim: array with the length of CellVarIndex, giving the space dimension of each field cell
-% CoordType: cell array with elements 'scattered','grid','tps'; type of coordinates for each field cell
-% VarRole: cell array of structures with fields
-%      .coord_x, y, z: indices (in .ListVarname) of variables representing scattered (unstructured) coordinates x, y, z 
-%      .vector_x,_y,_z: indices of variables giving the vector components x, y, z
-%      .warnflag: index of warnflag
-%      .errorflag: index of error flag
-%      .ancillary: indices of ancillary variables
-%      .image   : B/W image, (behaves like scalar)
-%      .color : color image, the last index, which is not a coordinate variable, represent the 3 color components rgb
-%      .discrete: like scalar, but set of data points without continuity, represented as dots in a usual plot, instead of continuous lines otherwise
-%      .scalar: scalar field (default)
-%      .coord: vector of indices of coordinate variables corresponding to matrix dimensions
-%
-%      .FieldRequest= 'interp_lin', 'interp_tps' indicate whether lin interpolation  or derivatives (tps) is needed to calculate the requested field
-%      .Operation = operation to be performed to finalise the field cell after projection
-%      .SubCheck=0 /1 indicate that the field must be substracted (second  entry in uvmat)
-% errormsg: error message
-%   
-% INPUT:
-% Data: structure representing fields, output of check_field_structure
-%            .ListVarName: cell array listing the names (cahr strings) of the variables
-%            .VarDimName: cell array of cells containing the set of dimension names for each variable of .ListVarName
-%            .VarAttribute: cell array of structures containing the variable attributes: 
-%                     .VarAttribute{ilist}.key=value, where ilist is the variable
-%                     index, key is the name of the attribute, value its value (char string or number)
-%
-% HELP: 
-% to get the dimensions of arrays common to the field #icell
-%         VarIndex=CellVarIndex{icell}; % list of variable indices
-%         DimIndex=Data.VarDimIndex{VarIndex(1)} % list of dimensions for each variable in the cell #icell
-%
-%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
-%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-%     This file is part of the toolbox UVMAT.
-% 
-%     UVMAT is free software; you can redistribute it and/or modify
-%     it under the terms of the GNU General Public License as published by
-%     the Free Software Foundation; either version 2 of the License, or
-%     (at your option) any later version.
-% 
-%     UVMAT is distributed in the hope that it will be useful,
-%     but WITHOUT ANY WARRANTY; without even the implied warranty of
-%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%     GNU General Public License (file UVMAT/COPYING.txt) for more details.for input in proj_field and plot_field
-%    group the variables  into 'fields' with common dimensions
-
-function [CellVarIndex,NbDim,CoordType,VarRole,errormsg]=find_field_cells(Data)
-CellVarIndex={};
-
-CellVarType=[];
-errormsg=[];
-if ~isfield(Data,'ListVarName'), erromsg='the list of variables .ListVarName is missing';return;end
-if ~isfield(Data,'VarDimName'), erromsg='the list of dimensions .VarDimName is missing';return;end
-nbvar=numel(Data.ListVarName);%number of field variables
-if ~isequal(numel(Data.VarDimName),nbvar), erromsg='.ListVarName and .VarDimName have unequal length';return;end
-if isfield(Data,'ListDimName')&& isfield(Data,'DimValue')&&isequal(numel(Data.ListDimName),numel(Data.DimValue))
-    check_dim=1;% dimensions of data defined, data not needed for this function
-else
-    check_dim=0;
-    for ilist=1:numel(ListVarName)
-        if ~isfield(Data,Data.ListVarName{ilist})
-            errormsg=['missing variable ' Data.ListVarName{ilist}];
-            return
-        end
-    end
-end
-icell=0;
-
-NbDim=[];
-VarDimIndex=[];
-VarDimName={};
-
-%% role of variables and list of requested operations
-%ListRole={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','vector_x_tps','vector_y_tps','warnflag','errorflag',...
-%   'ancillary','image','color','discrete','scalar','coord_tps'};% rmq vector_x_tps and vector_y_tps to be replaced by vector_x and vector_y
-Role=num2cell(blanks(nbvar));%initialize a cell array of nbvar blanks
-FieldRequest=regexprep(Role,' ',''); % fieldRequest set to '' by default
-Operation=cell(size(Role)); % fieldRequest set to {} by default
-CheckSub=zeros(size(Role));% =1 for fields to substract
-Role=regexprep(Role,' ','scalar'); % Role set to 'scalar' by default
-if isfield(Data,'VarAttribute')
-    for ivar=1:numel(Data.VarAttribute)
-        if isfield(Data.VarAttribute{ivar},'Role')
-            Role{ivar}=Data.VarAttribute{ivar}.Role;
-        end
-        if isfield(Data.VarAttribute{ivar},'FieldRequest')
-            FieldRequest{ivar}=Data.VarAttribute{ivar}.FieldRequest;
-        end
-        if isfield(Data.VarAttribute{ivar},'Operation')
-            Operation{ivar}=Data.VarAttribute{ivar}.Operation;
-        end
-        if isfield(Data.VarAttribute{ivar},'CheckSub')
-            CheckSub(ivar)=Data.VarAttribute{ivar}.CheckSub;
-        end
-    end
-end
-
-%% find scattered coordinates
-ivar_coord_x=find(strcmp('coord_x',Role);
-VarDimCell=cell(numel(ivar_coord_x));
-check_select=zeros(1,nbvar);
-CellVarIndex=cell(1,numel(ivar_coord_x));
-CoordType=cell(1,numel(ivar_coord_x));
-VarRole=cell(1,numel(ivar_coord_x));
-for icell=1:numel(ivar_coord_x)
-    DimCell=Data.VarDimName{ivar_coord_x(icell)};
-    if ischar(DimCell),DimCell={DimCell};end
-    check_cell=zeros(numel(DimCell),nbvar);
-    for idim=1:numel(DimCell)
-        for ivar=1:nbvar
-            check_cell(idim,ivar)=strcmp(DimCell{idim},Data.VarDimName{ivar});
-        end
-    end
-    check_cell=sum(check_cell,1)==numel(DimCell);%logical array=1 for variables belonging to the current cell
-    VarIndex=find(check_cell);
-    if ~(numel(VarIndex)==1 && numel(DimCell)==1)% exclude case of isolated coord_x variable (treated later)
-        if numel(VarIndex)==1 && numel(DimCell)>1% no variable associated to coordinate
-            NbDim(icell)=0;
-        else
-            VarRole{icell}.Coord=ivar_coord_x(icell);
-            ind_y=find(strcmp('coord_y',Role(CellVarIndex{icell})));
-            if numel(VarIndex)==2||isempty(ind_y)% no variable, except possibly y
-                NbDim(icell)=1;
-            else
-                CoordType{icell}='scattered';
-                ind_z=find(strcmp('coord_z',Role(CellVarIndex{icell})));
-                if numel(VarIndex)==3||isempty(ind_z)% no z variable, except possibly as a fct z(x,y)
-                    VarRole{icell}.Coord=[VarIndex(ind_y) VarRole{icell}.Coord];
-                    NbDim(icell)=2;
-                else
-                    VarRole{icell}.Coord=[VarIndex(ind_z) VarRole{icell}.Coord];
-                    NbDim(icell)=3;
-                end
-            end
-        end
-        CellVarIndex{icell}=VarIndex;
-        check_select=check_select|check_cell;
-    end
-end
-
-%% look for tps coordinates
-ivar_remain=find(~check_select);
-check_coord_tps= strcmp('coord_tps',Role(~check_select));
-ivar_tps=ivar_remain(check_coord_tps);
-for icell_tps=1:numel(ivar_tps)
-    DimCell=Data.VarDimName{ivar_tps(icell_tps)};
-    icell=numel(CellVarIndex)+icell_tps;
-    VarRole{icell}.Coord=ivar_tps(icell);
-    VarRole{icell}.subrange_tps=[];
-    VarRole{icell}.nbsites_tps=[];
-    if numel(DimCell)==3
-        VarDimName=Data.VarDimName(~check_select);
-        for ivardim=1:numel(VarDimName)
-            if strcmp(VarDimName{ivardim},DimCell{3})
-                VarRole{icell}.nbsites_tps= ivar_remain(ivardim);
-                check_cell(ivar_remain(ivardim))=1;% nbre of sites for each tps subdomain
-            elseif strcmp(VarDimName{ivardim}{1},DimCell{2}) && strcmp(VarDimName{ivardim}{3},DimCell{3})
-                VarRole{icell}.subrange_tps=ivar_remain(ivardim);
-                check_cell(ivar_remain(ivardim))=1;% subrange definiton for tps
-            elseif strcmp(VarDimName{ivardim}{1},DimCell{1}) && strcmp(VarDimName{ivardim}{2},DimCell{3})
-                check_cell(ivar_remain(ivardim))=1;% variable
-            end
-        end
-    end
-    if check_dim
-        check_index= strcmp(DimCell{2},Data.ListDimName);
-        NbDim(icell)=Data.DimValue(check_index);
-    else
-        NbDim(icell)=size(Data.(Data.ListVarName{VarRole{icell}.Coord}),2);
-    end
-    CoordType{icell}='tps';
-    CellVarIndex{icell}=find(check_cell);
-    check_select=check_select|check_cell;
-end
-
-%% look for dimension variables and corresponding gridded data
-ivar_remain=find(~check_select);
-check_coord= cellfun(@numel,VarDimName)==1|cellfun(@ischar,VarDimName)==1;% find variables with a single dimension
-ListCoordIndex=ivar_remain(check_coord);
-ListCoordName=Data.ListVarName(ListCoordIndex);
-ListDimName=Data.VarDimName(ListCoordIndex);
-for ilist=1:numel(ListCoordIndex)
-    if ischar(ListDimName{ilist})
-        ListDimName{ilist}=ListDimName(ilist);%transform string to cell
-    end
-    if check_dim
-        check_index= strcmp(ListDimName{ilist}{1},Data.ListDimName);
-       DimValue=Data.DimValue(check_index);
-    else
-       DimValue=numel(Data.(ListCoordName{ilist});
-    end
-    if DimValue==2% case of uniform grid coordinate defined by lower and upper bounds only
-        ListDimName{ilist}=ListCoordName{ilist};% look for dimensions with name equal to coordinate for 
-    end
-end
-NewCellVarIndex={};
-NewCellDimIndex={];
-NewNbDim=[];
-NewCoordType={};
-NewVarRole={};
-VarDimName=Data.VarDimName(~check_select);%dimensions of remaining variables
-for ivardim=1:numel(VarDimName) % loop on the list of remaining variables
-    DimCell=VarDimName{ivardim};% dimension names of the current variable
-    DimIndices=[];
-    for idim=1:numel(DimCell)
-        ind_dim=find(strcmp(DimCell{idim},ListDimName));%find the dim index in the list of coord dim
-        if ~isempty(ind_dim)
-        DimIndices=[DimIndices ind_dim]; %update the list of coord dims included in DimCell
-        end
-    end
-    check_previous=0;
-    for iprev=1:numel(NewCellVarIndex)
-        if isequal(DimIndices,NewCellDimIndex{iprev})
-            NewCellVarIndex{iprev}=[NewCellVarIndex{iprev} ivar_remain(ivardim)];%append the current variable index to the found field cell
-            check_previous=1;
-            break
-        end
-    end
-    if ~check_previous
-        nbcell=numel(NewCellVarIndex)+1;
-        NewCellVarIndex{nbcell}=[ivar_remain(ivardim)];% create a new field cell with the current variable index
-        NewCellDimIndex{nbcell}=DimIndices;
-        NewNbDim(nbcell)=numel(DimIndices);
-        NewCoordType{nbcell}='grid';
-        NewVarRole{nbcell}.Coord=ListCoordIndex(DimIndices);
-    end
-end
-CellVarIndex=[CellVarIndex NewCellVarIndex];
-NbDim=[NbDim NewNbDim];
-CoordType=[CoordType NewCoordType];
-VarRole=[VarRole NewVarRole];
-
-%% suppress empty cells
-check_empty=cellfun(@isempty,CellVarIndex);
-CellVarIndex(check_empty)=[];
-NbDim(check_empty)=[];
-CoordType(check_empty)=[];
-VarRole(check_empty)=[];
-
-%% document roles of non-coordinate variables
-ListRole={'vector_x','vector_y','vector_z','vector_x_tps','vector_y_tps','warnflag','errorflag',...
-   'ancillary','image','color','discrete','scalar'};% except coord,coord_x,_y,_z,Coord_tps already taken, into account
-for icell=1:numel(CellVarIndex)
-    VarIndex=CellVarIndex{icell};
-    for ivar=VarIndex
-        if isfield(VarRole{icell},Role{ivar})
-            VarRole{icell}.(Role{ivar})=[VarRole{icell}.(Role{ivar}) ivar];
-        else
-            VarRole{icell}.(Role{ivar})= ivar;
-        end
-        if ~isempty(FieldRequest{ivar})
-            VarRole{icell}.FieldRequest=FieldRequest{ivar};
-        end
-        if ~isempty(Operation{ivar})
-            VarRole{icell}.Operation=Operation{ivar};
-        end
-        if CheckSub{ivar}==1
-            VarRole{icell}.CheckSub=1;
-        end
-    end
-end
Index: /trunk/src/mouse_down.m
===================================================================
--- /trunk/src/mouse_down.m	(revision 574)
+++ /trunk/src/mouse_down.m	(revision 575)
@@ -114,9 +114,9 @@
                             for icell=1:numel(CellVarIndex)%look for all physical fields
                                 if NbDim(icell)==2 % select 2D field
-                                    if  isfield(Field,'Mesh') && ~isempty(Field.Mesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data
+                                    if  isfield(Field,'CoordMesh') && ~isempty(Field.CoordMesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data
                                         eval(['X=Field.' Field.ListVarName{VarType{icell}.coord_x} ';'])
                                         eval(['Y=Field.' Field.ListVarName{VarType{icell}.coord_y} ';'])
-                                        flag_vec=(X<(xy(1,1)+Field.Mesh/4) & X>(xy(1,1)-Field.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse
-                                            (Y<(xy(1,2)+Field.Mesh/4) & Y>(xy(1,2)-Field.Mesh/4));%f
+                                        flag_vec=(X<(xy(1,1)+Field.CoordMesh/4) & X>(xy(1,1)-Field.CoordMesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse
+                                            (Y<(xy(1,2)+Field.CoordMesh/4) & Y>(xy(1,2)-Field.CoordMesh/4));%f
                                         ivec=find(flag_vec,1);% search the (first) selected vector index ivec
                                     end
Index: /trunk/src/mouse_motion.m
===================================================================
--- /trunk/src/mouse_motion.m	(revision 574)
+++ /trunk/src/mouse_motion.m	(revision 575)
@@ -110,9 +110,9 @@
                     for icell=1:numel(CellInfo)%look for all physical fields
                         if NbDimArray(icell)>=2 % select 2D field
-                            if  isfield(Field,'Mesh') && ~isempty(Field.Mesh)&& strcmp(CellInfo{icell}.CoordType,'scattered')%case of unstructured data
+                            if  isfield(Field,'CoordMesh') && ~isempty(Field.CoordMesh)&& strcmp(CellInfo{icell}.CoordType,'scattered')%case of unstructured data
                                 X=Field.(Field.ListVarName{CellInfo{icell}.CoordIndex(end)});
                                 Y=Field.(Field.ListVarName{CellInfo{icell}.CoordIndex(end-1)});
-                                flag_vec=(X<(xy(1,1)+Field.Mesh/3) & X>(xy(1,1)-Field.Mesh/3)) & ...%flagx=1 for the vectors with x position selected by the mouse
-                                    (Y<(xy(1,2)+Field.Mesh/3) & Y>(xy(1,2)-Field.Mesh/3));%f
+                                flag_vec=(X<(xy(1,1)+Field.CoordMesh/3) & X>(xy(1,1)-Field.CoordMesh/3)) & ...%flagx=1 for the vectors with x position selected by the mouse
+                                    (Y<(xy(1,2)+Field.CoordMesh/3) & Y>(xy(1,2)-Field.CoordMesh/3));%f
                                 ivec=find(flag_vec,1);% search the (first) selected vector index ivec
                                 hhh=findobj(CurrentAxes,'Tag','vector_marker');
@@ -125,9 +125,9 @@
                                             set(CurrentFig,'CurrentAxes',CurrentAxes)
                                             rectangle('Curvature',[1 1],...
-                                                'Position',[X(ivec)-Field.Mesh/2 Y(ivec)-Field.Mesh/2 Field.Mesh Field.Mesh],'EdgeColor','m',...
+                                                'Position',[X(ivec)-Field.CoordMesh/2 Y(ivec)-Field.CoordMesh/2 Field.CoordMesh Field.CoordMesh],'EdgeColor','m',...
                                                 'LineStyle','-','Tag','vector_marker');
                                         else
                                             set(hhh,'Visible','on')
-                                            set(hhh,'Position',[X(ivec)-Field.Mesh/2 Y(ivec)-Field.Mesh/2 Field.Mesh Field.Mesh])
+                                            set(hhh,'Position',[X(ivec)-Field.CoordMesh/2 Y(ivec)-Field.CoordMesh/2 Field.CoordMesh Field.CoordMesh])
                                         end
                                     end
Index: /trunk/src/proj_field.m
===================================================================
--- /trunk/src/proj_field.m	(revision 574)
+++ /trunk/src/proj_field.m	(revision 575)
@@ -28,5 +28,5 @@
 %    .Txt: error message, transmitted to the projection
 %    .FieldList: cell array of strings representing the fields to calculate
-%    .Mesh: typical distance between data points (used for mouse action or display), transmitted
+%    .CoordMesh: typical distance between data points (used for mouse action or display), transmitted
 %    .CoordUnit, .TimeUnit, .dt: transmitted
 % standardised description of fields, nc-formated Matlab structure with fields:
@@ -321,5 +321,5 @@
 ProjData.VarAttribute={};
 
-Mesh=zeros(1,numel(FieldData.ListVarName));
+CoordMesh=zeros(1,numel(FieldData.ListVarName));
 if isfield (FieldData,'VarAttribute')
     %ProjData.VarAttribute=FieldData.VarAttribute;%list of variable attribute names
@@ -329,6 +329,6 @@
             unit{iattr}=FieldData.VarAttribute{iattr}.Unit;
         end
-        if isfield(FieldData.VarAttribute{iattr},'Mesh')
-            Mesh(iattr)=FieldData.VarAttribute{iattr}.Mesh;
+        if isfield(FieldData.VarAttribute{iattr},'CoordMesh')
+            CoordMesh(iattr)=FieldData.VarAttribute{iattr}.CoordMesh;
         end
     end
@@ -462,9 +462,9 @@
         ProjData.([VarName 'Min'])=min(double(FieldData.(VarName)(indsel,:))); % take the min in the selected region , for each color component
         ProjData.([VarName 'Max'])=max(double(FieldData.(VarName)(indsel,:))); % take the max in the selected region , for each color component
-        if isequal(Mesh(ivar),0)
-            eval(['[ProjData.' VarName 'Histo,ProjData.' VarName ']=hist(double(FieldData.' VarName '(indsel,:,:)),100);']); % default histogram with 100 bins
+        if isequal(CoordMesh(ivar),0)
+            [ProjData.([VarName 'Histo']),ProjData.(VarName)]=hist(double(FieldData.(VarName)(indsel,:,:)),100); % default histogram with 100 bins
         else
-            eval(['ProjData.' VarName '=(ProjData.' VarName 'Min+Mesh(ivar)/2:Mesh(ivar):ProjData.' VarName 'Max);']); % list of bin values
-            eval(['ProjData.' VarName 'Histo=hist(double(FieldData.' VarName '(indsel,:)),ProjData.' VarName ');']); % histogram at predefined bin positions
+            ProjData.(VarName)=ProjData.([VarName 'Min'])+CoordMesh(ivar)/2:CoordMesh(ivar):ProjData.([VarName 'Max']); % list of bin values
+            ProjData.([VarName 'Histo'])=hist(double(FieldData.(VarName)(indsel,:)),ProjData.(VarName)); % histogram at predefined bin positions
         end
         ProjData.ListVarName=[ProjData.ListVarName {VarName} {[VarName 'Histo']} {[VarName 'Mean']} {[VarName 'Min']} {[VarName 'Max']}];
@@ -891,11 +891,11 @@
 if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX)
      DX=abs(ObjectData.DX);%mesh of interpolation points 
-% else
-%     DX=FieldData.Mesh;
+else
+     DX=FieldData.CoordMesh;
 end
 if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY)
      DY=abs(ObjectData.DY);%mesh of interpolation points 
-% else
-%     DY=FieldData.Mesh;
+else
+     DY=FieldData.CoordMesh;
 end
 if  ~strcmp(ObjectData.ProjMode,'projection') && (isempty(DX)||isempty(DY))
@@ -962,7 +962,7 @@
 ProjData.VarAttribute={};
 if ~isempty(DX) && ~isempty(DY)
-    ProjData.Mesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
-elseif isfield(FieldData,'Mesh')
-    ProjData.Mesh=FieldData.Mesh;
+    ProjData.CoordMesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
+elseif isfield(FieldData,'CoordMesh')
+    ProjData.CoordMesh=FieldData.CoordMesh;
 end
 error=0;%default
@@ -1656,7 +1656,7 @@
 ProjData.VarDimName={};
 if ~isequal(DX,0)&& ~isequal(DY,0)
-    ProjData.Mesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
-elseif isfield(FieldData,'Mesh')
-    ProjData.Mesh=FieldData.Mesh;
+    ProjData.CoordMesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
+elseif isfield(FieldData,'CoordMesh')
+    ProjData.CoordMesh=FieldData.CoordMesh;
 end
 
Index: /trunk/src/read_field.m
===================================================================
--- /trunk/src/read_field.m	(revision 574)
+++ /trunk/src/read_field.m	(revision 575)
@@ -36,16 +36,20 @@
 errormsg='';
 A=[];
+InputField={};
+check_colorvar=0;
 if isstruct(ParamIn)
-    if isfield(ParamIn,'FieldName')&& ischar(ParamIn.FieldName)
-        ParamIn.FieldName={ParamIn.FieldName};
+    if isfield(ParamIn,'FieldName')
+        if ischar(ParamIn.FieldName)
+            ParamIn.FieldName={ParamIn.FieldName};
+        else
+            InputField= ParamIn.FieldName;
+        end
     end
     if isfield(ParamIn,'ColorVar')
         InputField=[ParamIn.FieldName {ParamIn.ColorVar}];
         check_colorvar=1;
-    else
-        InputField= ParamIn.FieldName;
-        check_colorvar=0;
     end
 end
+
 %% distingush different input file types
 switch FileType
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 574)
+++ /trunk/src/uvmat.m	(revision 575)
@@ -2498,5 +2498,5 @@
         end
     end
-    UvData.Field.Mesh=min(Mesh);
+    UvData.Field.CoordMesh=min(Mesh);
     UvData.Field.XMax=max(CoordMax(ind,end));
     UvData.Field.XMin=min(CoordMin(ind,end));
@@ -2508,11 +2508,11 @@
     end
     % adjust the mesh to a value 1, 2 , 5 *10^n
-    ord=10^(floor(log10(UvData.Field.Mesh)));%order of magnitude
-    if UvData.Field.Mesh/ord>=5
-        UvData.Field.Mesh=5*ord;
-    elseif UvData.Field.Mesh/ord>=2
-        UvData.Field.Mesh=2*ord;
+    ord=10^(floor(log10(UvData.Field.CoordMesh)));%order of magnitude
+    if UvData.Field.CoordMesh/ord>=5
+        UvData.Field.CoordMesh=5*ord;
+    elseif UvData.Field.CoordMesh/ord>=2
+        UvData.Field.CoordMesh=2*ord;
     else
-        UvData.Field.Mesh=ord;
+        UvData.Field.CoordMesh=ord;
     end
     % default projection plane
@@ -2535,5 +2535,5 @@
             delete_object(1);% delete the current projection object in the list UvData.Object, delete its graphic representations and update the list displayed in handles.ListObject and 2
             UvData.Object{1}.NbDim=NbDim;%test for 3D objects
-            UvData.Object{1}.RangeZ=UvData.Field.Mesh;%main plotting plane
+            UvData.Object{1}.RangeZ=UvData.Field.CoordMesh;%main plotting plane
             UvData.Object{1}.Coord(1,3)=(UvData.Field.ZMin+UvData.Field.ZMax)/2;%section at a middle plane chosen
             UvData.Object{1}.Angle=[0 0 0];
@@ -2689,6 +2689,6 @@
                 [PlotType,PlotParamOut]=plot_field(ObjectData,haxes(imap),PlotParam{imap},PosColorbar{imap});
                 write_plot_param(plot_handles{imap},PlotParamOut) %update the auto plot parameters
-                if isfield(Field,'Mesh')&&~isempty(Field.Mesh)
-                    ObjectData.Mesh=Field.Mesh; % gives an estimated mesh size (useful for mouse action on the plot)
+                if isfield(Field,'CoordMesh')&&~isempty(Field.CoordMesh)
+                    ObjectData.CoordMesh=Field.CoordMesh; % gives an estimated mesh size (useful for mouse action on the plot)
                 end
             end
@@ -3363,9 +3363,9 @@
         data.CoordType=UvData.CoordType;
     end
-    if isfield(UvData.Field,'Mesh')&~isempty(UvData.Field.Mesh)
+    if isfield(UvData.Field,'CoordMesh')&~isempty(UvData.Field.CoordMesh)
         data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
         data.RangeY=[UvData.Field.YMin UvData.Field.YMax];
-        data.DX=UvData.Field.Mesh;
-        data.DY=UvData.Field.Mesh;
+        data.DX=UvData.Field.CoordMesh;
+        data.DY=UvData.Field.CoordMesh;
     elseif isfield(UvData.Field,'AX')&isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')%only image
         np=size(UvData.Field.A);
@@ -4527,13 +4527,13 @@
 if isfield(UvData,'Field')
     Field=UvData.Field;
-    if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh)
+    if isfield(UvData.Field,'CoordMesh')&&~isempty(UvData.Field.CoordMesh)
         data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
         if strcmp(data.Type,'line')||strcmp(data.Type,'polyline')||strcmp(data.Type,'points')
-            data.RangeY=UvData.Field.Mesh;
+            data.RangeY=UvData.Field.CoordMesh;
         else
             data.RangeY=[UvData.Field.YMin UvData.Field.YMax];
         end
-        data.DX=UvData.Field.Mesh;
-        data.DY=UvData.Field.Mesh;
+        data.DX=UvData.Field.CoordMesh;
+        data.DY=UvData.Field.CoordMesh;
     end
     if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)
