Index: /trunk/src/calc_field_interp.m
===================================================================
--- /trunk/src/calc_field_interp.m	(revision 643)
+++ /trunk/src/calc_field_interp.m	(revision 644)
@@ -17,4 +17,5 @@
 function [VarVal,ListVarName,VarAttribute,errormsg]=calc_field_interp(Coord,Data,FieldName,XI,YI)
 
+%% initialization
 VarVal={};
 ListVarName={};
@@ -25,4 +26,6 @@
 check_skipped=zeros(size(FieldName));% default, =1 to mark the variables which can be calculated
 Operator=cell(size(FieldName));
+
+%% analyse the list of input fields: needed variables and requested operations
 for ilist=1:numel(FieldName)
     Operator{ilist}='';%default empty operator (vec, norm,...)
@@ -66,5 +69,6 @@
     end
 end
-%create interpolator for linear interpolation
+
+%% create interpolator for each variable to interpolate
 if exist('XI','var')
     for ilist=1:numel(InputVarList)
@@ -72,4 +76,6 @@
     end
 end
+
+%% perform the linear interpolation for the requested variables
 for ilist=1:numel(FieldName)
     if ~check_skipped(ilist)
@@ -120,5 +126,6 @@
     end
 end
-% put an error flag to indicate NaN data
+
+%% put an error flag to indicate NaN data
 if exist('XI','var')&&~isempty(VarVal)
     nbvar=numel(ListVarName);
@@ -128,9 +135,6 @@
 end
 
-% Attr_FF.Role='errorflag';
-% VarAttribute=[VarAttribute {Attr_FF}];
 
 
 
 
-
Index: /trunk/src/get_field.m
===================================================================
--- /trunk/src/get_field.m	(revision 643)
+++ /trunk/src/get_field.m	(revision 644)
@@ -22,5 +22,5 @@
 function varargout = get_field(varargin)
 
-% Last Modified by GUIDE v2.5 05-May-2013 23:54:32
+% Last Modified by GUIDE v2.5 28-May-2013 01:55:25
 
 % Begin initialization code - DO NOT EDIT
@@ -186,8 +186,8 @@
     option=1;
 end
-set(handles.SwitchVarIndexTime,'String',ListSwitchVarIndexTime)
-set(handles.SwitchVarIndexTime,'Value',option)
+%set(handles.SwitchVarIndexTime,'String',ListSwitchVarIndexTime)
+%set(handles.SwitchVarIndexTime,'Value',option)
 set(handles.get_field,'UserData',Field);% record the finput field structure
-SwitchVarIndexTime_Callback([],[], handles)
+%SwitchVarIndexTime_Callback([],[], handles)
 
 %% set z coordinate menu if relevant
@@ -201,5 +201,5 @@
     set(handles.vector_z,'Visible','off')
     set(handles.ZVarName,'Visible','off')
-    set(handles.SwitchVarIndexZ,'Visible','off')
+%    set(handles.SwitchVarIndexZ,'Visible','off')
     set(handles.Z_title,'Visible','off')
 end
@@ -207,5 +207,4 @@
 %% set vector menu (priority) if detected or scalar menu for space dim >=2, or usual (x,y) plot for 1D fields
 if Field.MaxDim>=2 % case of 2D (or 3D) fields
-    set(handles.CheckPlot1D,'Value',0)
     if isfield(CellInfo{imax},'VarIndex_vector_x') &&  isfield(CellInfo{imax},'VarIndex_vector_y') 
         set(handles.CheckVector,'Value',1)
@@ -213,13 +212,12 @@
         set(handles.vector_x,'Value',CellInfo{imax}.VarIndex_vector_x(1))
         set(handles.vector_y,'Value',CellInfo{imax}.VarIndex_vector_y(1))
+        set(handles.FieldOption,'Value',3)
     else
-        set(handles.CheckScalar,'Value',1)
-        set(handles.CheckVector,'Value',0)
+        set(handles.FieldOption,'Value',2)
     end
 else % case of 1D fields
-    set(handles.CheckPlot1D,'Value',1)
-    set(handles.CheckScalar,'Value',0)
-    set(handles.CheckVector,'Value',0)
-end
+    set(handles.FieldOption,'Value',1)
+end
+
 
 %% Make choices in menus from input
@@ -227,7 +225,5 @@
     fill_GUI(ParamIn,handles.get_field);
 end
-CheckPlot1D_Callback(handles.CheckPlot1D, [], handles)
-CheckScalar_Callback(handles.CheckScalar, [], handles)
-CheckVector_Callback(handles.CheckVector, [], handles)
+FieldOption_Callback([],[],handles)
 
 %------------------------------------------------------------------------
@@ -335,19 +331,5 @@
     set(handles.Panel1Dplot,'Visible','off')
 else
-    set(handles.Panel1Dplot,'Visible','on')
-    set(handles.PanelScalar,'Visible','off')
-    set(handles.CheckScalar,'Value',0)
-    set(handles.PanelVectors,'Visible','off')
-    set(handles.CheckVector,'Value',0)
-    set(handles.XVarName,'Visible','on')
-    set(handles.SwitchVarIndexX,'Visible','on')
-    set(handles.X_title,'Visible','on')
-    set(handles.YVarName,'Visible','off')
-    set(handles.SwitchVarIndexY,'Visible','off')
-    set(handles.Y_title,'Visible','off')
-    set(handles.ZVarName,'Visible','off')
-    set(handles.SwitchVarIndexZ,'Visible','off')
-    set(handles.Z_title,'Visible','off')
-    ordinate_Callback(hObject, eventdata, handles)
+   
 end
 
@@ -386,9 +368,5 @@
     set(handles.PanelScalar,'Visible','off')
 else
-    set(handles.Panel1Dplot,'Visible','off')
-    set(handles.CheckPlot1D,'Value',0)
-    set(handles.PanelScalar,'Visible','on')
-    set(handles.PanelVectors,'Visible','off')
-    set(handles.CheckVector,'Value',0)
+    
 end
 
@@ -401,13 +379,5 @@
     set(handles.PanelVectors,'Visible','off')
 else
-    set(handles.Panel1Dplot,'Visible','off')
-    set(handles.CheckPlot1D,'Value',0)
-    set(handles.PanelScalar,'Visible','off')
-    set(handles.CheckScalar,'Value',0)
-    set(handles.PanelVectors,'Visible','on')
-    set(handles.XVarName,'Visible','on')
-    set(handles.YVarName,'Visible','on')
-    set(handles.X_title,'Visible','on')
-    set(handles.Y_title,'Visible','on')
+    
 end
 
@@ -425,6 +395,6 @@
 %eliminate time
 TimeDimName='';%default
-SwitchVarIndexTime=get(handles.SwitchVarIndexTime,'String');
-TimeVarOption=SwitchVarIndexTime{get(handles.SwitchVarIndexTime,'Value')};
+% SwitchVarIndexTime=get(handles.SwitchVarIndexTime,'String');
+% TimeVarOption=SwitchVarIndexTime{get(handles.SwitchVarIndexTime,'Value')};
 if strcmp(TimeVarOption,'variable')
     List=get(handles.TimeVarName,'String');
@@ -1415,15 +1385,4 @@
 
 
-
-% --- Executes on selection change in listbox30.
-function listbox30_Callback(hObject, eventdata, handles)
-% hObject    handle to listbox30 (see GCBO)
-% eventdata  reserved - to be defined in a future version of MATLAB
-% handles    structure with handles and user data (see GUIDATA)
-
-% Hints: contents = cellstr(get(hObject,'String')) returns listbox30 contents as cell array
-%        contents{get(hObject,'Value')} returns selected item from listbox30
-
-
 % --- Executes on selection change in SwitchVarIndexX.
 function SwitchVarIndexX_Callback(hObject, eventdata, handles)
@@ -1488,19 +1447,122 @@
 end
 
-
-% --- Executes on button press in CheckScalar.
-function checkbox22_Callback(hObject, eventdata, handles)
-% hObject    handle to CheckScalar (see GCBO)
+% --- Executes on selection change in FieldOption.
+function FieldOption_Callback(hObject, eventdata, handles)
+FieldList=get(handles.FieldOption,'String');
+FieldOption=FieldList{get(handles.FieldOption,'Value')};
+switch FieldOption
+    case '1D plot'
+         set(handles.Panel1Dplot,'Visible','on')
+         pos=get(handles.Panel1Dplot,'Position');
+         pos(1)=2;
+         pos_coord=get(handles.Coordinates,'Position');
+         pos(2)=pos_coord(2)-pos(4)-2;
+         set(handles.Panel1Dplot,'Position',pos)
+    set(handles.PanelScalar,'Visible','off')
+    set(handles.PanelVectors,'Visible','off')
+    set(handles.YVarName,'Visible','off')
+%    set(handles.SwitchVarIndexY,'Visible','off')
+    set(handles.Y_title,'Visible','off')
+    set(handles.ZVarName,'Visible','off')
+ %   set(handles.SwitchVarIndexZ,'Visible','off')
+    set(handles.Z_title,'Visible','off')
+%    ordinate_Callback(hObject, eventdata, handles)
+%         set(handles.get_field,'Units','pixels')
+% size_fig=get(handles.get_field,'Position');
+% Data=get(handles.view_field,'UserData');
+% Data.GUISize=size_fig;
+% set(handles.view_field,'UserData',Data)
+% 
+% %% reset position of text_display or TableDisplay
+% if strcmp(get(handles.TableDisplay,'Visible'),'off')
+%     pos_1=get(handles.text_display,'Position');
+%     pos_1(1)=size_fig(3)-pos_1(3);
+%     pos_1(2)=size_fig(4)-pos_1(4);
+%     set(handles.text_display,'Position',pos_1)
+%     % reset position of TableDisplay
+% else
+%     pos_1=get(handles.TableDisplay,'Position');
+%     pos_1(1)=size_fig(3)-pos_1(3);
+%     pos_1(2)=size_fig(4)-pos_1(4);
+%     set(handles.TableDisplay,'Position',pos_1)
+% end
+% 
+% %% reset position of Coordinates
+% pos_2=get(handles.Coordinates,'Position');
+% pos_2(1)=size_fig(3)-pos_1(3);
+% pos_2(2)=pos_1(2)-pos_2(4);
+% set(handles.Coordinates,'Position',pos_2)
+    case 'scalar'
+        set(handles.Panel1Dplot,'Visible','off')
+    set(handles.PanelScalar,'Visible','on')
+    set(handles.PanelVectors,'Visible','off')
+         pos=get(handles.PanelScalar,'Position');
+         pos(1)=2;
+         pos_coord=get(handles.Coordinates,'Position');
+         pos(2)=pos_coord(2)-pos(4)-2;
+         set(handles.PanelScalar,'Position',pos)
+    set(handles.YVarName,'Visible','on')
+    set(handles.Y_title,'Visible','on')
+    case 'vectors'
+        set(handles.Panel1Dplot,'Visible','off')
+    set(handles.PanelScalar,'Visible','off')
+    set(handles.PanelVectors,'Visible','on')
+    pos=get(handles.PanelVectors,'Position');
+         pos(1)=2;
+         pos_coord=get(handles.Coordinates,'Position');
+         pos(2)=pos_coord(2)-pos(4)-2;
+         set(handles.PanelVectors,'Position',pos)
+    set(handles.YVarName,'Visible','on')
+    set(handles.Y_title,'Visible','on')
+end
+% hObject    handle to FieldOption (see GCBO)
 % eventdata  reserved - to be defined in a future version of MATLAB
 % handles    structure with handles and user data (see GUIDATA)
 
-% Hint: get(hObject,'Value') returns toggle state of CheckScalar
-
-
-% --- Executes on button press in checkbox23.
-function checkbox23_Callback(hObject, eventdata, handles)
-% hObject    handle to checkbox23 (see GCBO)
+% Hints: contents = get(hObject,'String') returns FieldOption contents as cell array
+%        contents{get(hObject,'Value')} returns selected item from FieldOption
+
+
+% --- Executes on button press in CheckDimensionX.
+function CheckDimensionX_Callback(hObject, eventdata, handles)
+% hObject    handle to CheckDimensionX (see GCBO)
 % eventdata  reserved - to be defined in a future version of MATLAB
 % handles    structure with handles and user data (see GUIDATA)
 
-% Hint: get(hObject,'Value') returns toggle state of checkbox23
+% Hint: get(hObject,'Value') returns toggle state of CheckDimensionX
+
+
+% --- Executes on button press in checkbox25.
+function checkbox25_Callback(hObject, eventdata, handles)
+% hObject    handle to checkbox25 (see GCBO)
+% eventdata  reserved - to be defined in a future version of MATLAB
+% handles    structure with handles and user data (see GUIDATA)
+
+% Hint: get(hObject,'Value') returns toggle state of checkbox25
+
+
+% --- Executes on button press in checkbox26.
+function checkbox26_Callback(hObject, eventdata, handles)
+% hObject    handle to checkbox26 (see GCBO)
+% eventdata  reserved - to be defined in a future version of MATLAB
+% handles    structure with handles and user data (see GUIDATA)
+
+% Hint: get(hObject,'Value') returns toggle state of checkbox26
+
+
+% --- Executes on button press in checkbox27.
+function checkbox27_Callback(hObject, eventdata, handles)
+% hObject    handle to checkbox27 (see GCBO)
+% eventdata  reserved - to be defined in a future version of MATLAB
+% handles    structure with handles and user data (see GUIDATA)
+
+% Hint: get(hObject,'Value') returns toggle state of checkbox27
+
+
+% --- Executes on button press in checkbox29.
+function checkbox29_Callback(hObject, eventdata, handles)
+% hObject    handle to checkbox29 (see GCBO)
+% eventdata  reserved - to be defined in a future version of MATLAB
+% handles    structure with handles and user data (see GUIDATA)
+
+% Hint: get(hObject,'Value') returns toggle state of checkbox29
Index: /trunk/src/plot_field.m
===================================================================
--- /trunk/src/plot_field.m	(revision 643)
+++ /trunk/src/plot_field.m	(revision 644)
@@ -197,12 +197,13 @@
     end
 else %plot 1D field (usual graph y vs x)
-    PlotParamOut.Coordinates=plot_profile(Data,CellInfo(index_1D),haxes,PlotParamOut.Coordinates);%
+    CheckHold=0;
+    if isfield(PlotParam,'CheckHold') 
+        CheckHold= PlotParam.CheckHold;
+    end       
+    PlotParamOut.Coordinates=plot_profile(Data,CellInfo(index_1D),haxes,PlotParamOut.Coordinates,CheckHold);%
     if testzoomaxes
-        [zoomaxes,PlotParamOut.Coordinates]=plot_profile(Data,CellInfo(index_1D),zoomaxes,PlotParamOut.Coordinates);
+        [zoomaxes,PlotParamOut.Coordinates]=plot_profile(Data,CellInfo(index_1D),zoomaxes,PlotParamOut.Coordinates,CheckHold);
         AxeData.ZoomAxes=zoomaxes;
     end
-%     if ~isempty(Coordinates)
-%         PlotParamOut.Coordinates=Coordinates;
-%     end
     PlotType='line';
 end
@@ -327,7 +328,8 @@
 
 %-------------------------------------------------------------------
-function CoordinatesOut=plot_profile(data,CellInfo,haxes,Coordinates)
+function CoordinatesOut=plot_profile(data,CellInfo,haxes,Coordinates,CheckHold)
 %-------------------------------------------------------------------
 
+%% initialization
 if ~exist('Coordinates','var')
     Coordinates=[];
@@ -335,5 +337,7 @@
 CoordinatesOut=Coordinates; %default
 hfig=get(haxes,'parent');
-%suppress existing plot isf empty data
+legend_str={};
+
+%% suppress existing plot if empty data
 if isempty(data)
     hplot=findobj(haxes,'tag','plot_line');
@@ -348,19 +352,22 @@
 end
 
+%% set the colors of the successive plots (designed to produce rgb for the three components of color images)
 ColorOrder=[1 0 0;0 0.5 0;0 0 1;0 0.75 0.75;0.75 0 0.75;0.75 0.75 0;0.25 0.25 0.25];
 set(haxes,'ColorOrder',ColorOrder)
-if isfield(Coordinates,'NextPlot')
-    set(haxes,'NextPlot',Coordinates.NextPlot)
-end
-% adjust the size of the plot to include the whole field,
-
-legend_str={};
+% if isfield(Coordinates,'NextPlot')
+%     set(haxes,'NextPlot',Coordinates.NextPlot)
+% end
+if CheckHold
+     set(haxes,'NextPlot','add')
+else
+    set(haxes,'NextPlot','replace')
+end
 
 %% prepare the string for plot command
 plotstr='hhh=plot(';
-coord_x_index=[];
+% coord_x_index=[];
 xtitle='';
 ytitle='';
-test_newplot=1;
+test_newplot=~CheckHold;
 MinX=[];
 MaxX=[];
@@ -421,5 +428,4 @@
             end
             eval(['data.' VarName '=squeeze(data.' VarName ');'])
-            %eval(['min(data.' VarName ')'])
             MinY(ivar)=min(min(data.(VarName)));
             MaxY(ivar)=max(max(data.(VarName)));
@@ -446,5 +452,5 @@
 
 %% activate the plot
-if test_newplot && ~isequal(plotstr,'hhh=plot(')  
+if  ~isequal(plotstr,'hhh=plot(')  
     set(hfig,'CurrentAxes',haxes)
     tag=get(haxes,'tag');    
Index: /trunk/src/proj_field.m
===================================================================
--- /trunk/src/proj_field.m	(revision 643)
+++ /trunk/src/proj_field.m	(revision 644)
@@ -564,5 +564,5 @@
    VarIndex=find(check_proj);
 
-    %identify vector components   
+    %% identify vector components   
     testU=isfield(CellInfo{icell},'VarIndex_vector_x') &&isfield(CellInfo{icell},'VarIndex_vector_y') ;% test for vectors
     if testU
@@ -578,16 +578,17 @@
         errorflag=FieldData.(FFName);
     end   
-    % check needed object properties for unstructured positions (position given by the variables with role coord_x, coord_y
+    
+    %% check needed object properties for unstructured positions (position given by the variables with role coord_x, coord_y
     if strcmp(CellInfo{icell}.CoordType,'scattered')
-        if  ~isequal(ProjMode,'interp_lin')
+        if  strcmp(ProjMode,'projection') 
             if width==0
                 errormsg='range of the projection object is missing';
-                return      
-            else
-                lambda=2/(width*width); %smoothing factor used for interp_tps: weight exp(-2) at distance width from the line
-            end
-        end
-        if ~isequal(ProjMode,'projection')
-            if isfield(ObjectData,'DX')&~isempty(ObjectData.DX)
+                return  
+            end
+%             else
+%                 lambda=2/(width*width); %smoothing factor used for interp_tps: weight exp(-2) at distance width from the line
+%             end
+        else
+            if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX)
                 DX=abs(ObjectData.DX);%mesh of interpolation points along the line
             else
@@ -601,5 +602,6 @@
         coord_y=FieldData.(YName);
     end   
-    %initiate projection
+    
+    %% initiate projection
     for ivar=1:length(VarIndex)
         ProjLine{ivar}=[];
@@ -612,234 +614,282 @@
   %%%%%%%  % A FAIRE CALCULER MEAN DES QUANTITES    %%%%%%
    %case of unstructured coordinates
-    if strcmp(CellInfo{icell}.CoordType,'scattered')  
-        for ip=1:siz_line(1)-1     %Loop on the segments of the polyline
-            linelength=sqrt(dlinx(ip)*dlinx(ip)+dliny(ip)*dliny(ip));  
-            %select the vector indices in the range of action
-            if testfalse
-                flagsel=(errorflag==0); % keep only non false vectors
-            else
-                flagsel=ones(size(coord_x));
-            end
-            if isequal(ProjMode,'projection') %|| isequal(ProjMode,'interp_tps')
-                flagsel=flagsel & ((coord_y -yinf(ip))*(xinf(ip+1)-xinf(ip))>(coord_x-xinf(ip))*(yinf(ip+1)-yinf(ip))) ...
-                & ((coord_y -ysup(ip))*(xsup(ip+1)-xsup(ip))<(coord_x-xsup(ip))*(ysup(ip+1)-ysup(ip))) ...
-                & ((coord_y -yinf(ip+1))*(xsup(ip+1)-xinf(ip+1))>(coord_x-xinf(ip+1))*(ysup(ip+1)-yinf(ip+1))) ...
-                & ((coord_y -yinf(ip))*(xsup(ip)-xinf(ip))<(coord_x-xinf(ip))*(ysup(ip)-yinf(ip)));
-            end
-            indsel=find(flagsel);%indsel =indices of good vectors 
-            X_sel=coord_x(indsel);
-            Y_sel=coord_y(indsel);
-            nbvar=0;
-            for iselect=1:numel(VarIndex)-2*testU
-                VarName=FieldData.ListVarName{VarIndex(iselect)};
-                ProjVar{iselect}=FieldData.(VarName)(indsel);%scalar value
-            end   
-            if testU
-                ProjVar{numel(VarIndex)-1}=cos(theta(ip))*vector_x(indsel)+sin(theta(ip))*vector_y(indsel);% longitudinal component
-                ProjVar{numel(VarIndex)}=-sin(theta(ip))*vector_x(indsel)+cos(theta(ip))*vector_y(indsel);%transverse component         
-            end
-            if isequal(ProjMode,'projection')
-                sintheta=sin(theta(ip));
-                costheta=cos(theta(ip));
-                Xproj=(X_sel-ObjectData.Coord(ip,1))*costheta + (Y_sel-ObjectData.Coord(ip,2))*sintheta; %projection on the line
-                [Xproj,indsort]=sort(Xproj);
-                for ivar=1:numel(ProjVar)
-                    if ~isempty(ProjVar{ivar})
-                        ProjVar{ivar}=ProjVar{ivar}(indsort);
-                     end
-                end
-            elseif isequal(ProjMode,'interp_lin') %linear interpolation:
-                npoint=floor(linelength/DX)+1;% nbre of points in the profile (interval DX)
-                Xproj=linelength/(2*npoint):linelength/npoint:linelength-linelength/(2*npoint);
-                xreg=cos(theta(ip))*Xproj+ObjectData.Coord(ip,1);
-                yreg=sin(theta(ip))*Xproj+ObjectData.Coord(ip,2);
-                for ivar=1:numel(ProjVar)
-                     if ~isempty(ProjVar{ivar})
-                        ProjVar{ivar}=griddata_uvmat(X_sel,Y_sel,ProjVar{ivar},xreg,yreg);
-                     end
-                end
-            elseif isequal(ProjMode,'interp_tps') %filtering
-                npoint=floor(linelength/DX)+1;% nbre of points in the profile (interval DX)
-                Xproj=linelength/(2*npoint):linelength/npoint:linelength-linelength/(2*npoint);
-                siz=size(X_sel);
-                xregij=cos(theta(ip))*ones(siz(1),1)*Xproj+ObjectData.Coord(ip,1);
-                yregij=sin(theta(ip))*ones(siz(1),1)*Xproj+ObjectData.Coord(ip,2);
-                xij=X_sel*ones(1,npoint);
-                yij=Y_sel*ones(1,npoint);
-                Aij=exp(-lambda*((xij-xregij).*(xij-xregij)+(yij-yregij).*(yij-yregij)));
-                norm=Aij'*ones(siz(1),1);
-                for ivar=1:numel(ProjVar)
-                     if ~isempty(ProjVar{ivar})
-                        ProjVar{ivar}=Aij'*ProjVar{ivar}./norm;
-                     end
-                end              
-            end
-            %prolongate the total record
-            for ivar=1:numel(ProjVar)
-                  if ~isempty(ProjVar{ivar})
-                     ProjLine{ivar}=[ProjLine{ivar}; ProjVar{ivar}];
-                  end
-            end
-            XLine=[XLine ;(Xproj+linelengthtot)];%along line abscissa
-            linelengthtot=linelengthtot+linelength;
-            %     circul=circul+(sum(U_sel))*linelength/npoint;
-            %     flux=flux+(sum(V_sel))*linelength/npoint;
-        end
-        ProjData.X=XLine';
-        ProjData.ListVarName=[ProjData.ListVarName {XName}];
-        ProjData.VarDimName=[ProjData.VarDimName {XName}];
-        ProjData.VarAttribute{1}.long_name='abscissa along line';
-        for iselect=1:numel(VarIndex)
-            VarName=FieldData.ListVarName{VarIndex(iselect)};
-            eval(['ProjData.' VarName '=ProjLine{iselect};'])
-            ProjData.ListVarName=[ProjData.ListVarName {VarName}];
-            ProjData.VarDimName=[ProjData.VarDimName {XName}];
-            ProjData.VarAttribute{iselect}=FieldData.VarAttribute{VarIndex(iselect)};
-            if strcmp(ProjMode,'projection')
-                ProjData.VarAttribute{iselect}.Role='discrete';
-            else
-                 ProjData.VarAttribute{iselect}.Role='continuous';
-            end
-        end
-    
-    %case of structured coordinates
-    elseif strcmp(CellInfo{icell}.CoordType,'grid')
-        if ~isequal(ObjectData.Type,'line')% exclude polyline
-            errormsg=['no  projection available on ' ObjectData.Type 'for structured coordinates']; % 
-        else
-            test_Amat=1;%image or 2D matrix
-            test_interp2=0;%default 
-            AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
-            AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
-            eval(['AX=FieldData.' AXName ';']);% set of x positions
-            eval(['AY=FieldData.' AYName ';']);% set of y positions  
-            AName=FieldData.ListVarName{VarIndex(1)};
-            eval(['A=FieldData.' AName ';']);% scalar
-            npxy=size(A);
-            npx=npxy(2);
-            npy=npxy(1); 
-            if numel(AX)==2
-                DX=(AX(2)-AX(1))/(npx-1);
-            else
-                DX_vec=diff(AX);
-                DX=max(DX_vec);
-                DX_min=min(DX_vec);
-                if (DX-DX_min)>0.0001*abs(DX) 
-                    test_interp2=1;
-                    DX=DX_min;
-                end    
-            end
-            if numel(AY)==2
-                DY=(AY(2)-AY(1))/(npy-1);
-            else
-                DY_vec=diff(AY);
-                DY=max(DY_vec);
-                DY_min=min(DY_vec);
-                if (DY-DY_min)>0.0001*abs(DY)
+   if strcmp(CellInfo{icell}.CoordType,'scattered')
+       for ip=1:siz_line(1)-1     %Loop on the segments of the polyline
+           linelength=sqrt(dlinx(ip)*dlinx(ip)+dliny(ip)*dliny(ip));
+           %select the vector indices in the range of action
+           if testfalse
+               flagsel=(errorflag==0); % keep only non false vectors
+           else
+               flagsel=ones(size(coord_x));
+           end
+           if isequal(ProjMode,'projection') %|| isequal(ProjMode,'interp_tps')
+               flagsel=flagsel & ((coord_y -yinf(ip))*(xinf(ip+1)-xinf(ip))>(coord_x-xinf(ip))*(yinf(ip+1)-yinf(ip))) ...
+                   & ((coord_y -ysup(ip))*(xsup(ip+1)-xsup(ip))<(coord_x-xsup(ip))*(ysup(ip+1)-ysup(ip))) ...
+                   & ((coord_y -yinf(ip+1))*(xsup(ip+1)-xinf(ip+1))>(coord_x-xinf(ip+1))*(ysup(ip+1)-yinf(ip+1))) ...
+                   & ((coord_y -yinf(ip))*(xsup(ip)-xinf(ip))<(coord_x-xinf(ip))*(ysup(ip)-yinf(ip)));
+           end
+           indsel=find(flagsel);%indsel =indices of good vectors
+           X_sel=coord_x(indsel);
+           Y_sel=coord_y(indsel);
+           nbvar=0;
+           for iselect=1:numel(VarIndex)-2*testU
+               VarName=FieldData.ListVarName{VarIndex(iselect)};
+               ProjVar{iselect}=FieldData.(VarName)(indsel);%scalar value
+           end
+           if testU
+               ProjVar{numel(VarIndex)-1}=cos(theta(ip))*vector_x(indsel)+sin(theta(ip))*vector_y(indsel);% longitudinal component
+               ProjVar{numel(VarIndex)}=-sin(theta(ip))*vector_x(indsel)+cos(theta(ip))*vector_y(indsel);%transverse component
+           end
+           if isequal(ProjMode,'projection')
+               sintheta=sin(theta(ip));
+               costheta=cos(theta(ip));
+               Xproj=(X_sel-ObjectData.Coord(ip,1))*costheta + (Y_sel-ObjectData.Coord(ip,2))*sintheta; %projection on the line
+               [Xproj,indsort]=sort(Xproj);
+               for ivar=1:numel(ProjVar)
+                   if ~isempty(ProjVar{ivar})
+                       ProjVar{ivar}=ProjVar{ivar}(indsort);
+                   end
+               end
+           elseif isequal(ProjMode,'interp_lin')||isequal(ProjMode,'interp_tps') %filtering %linear interpolation:
+               npoint=floor(linelength/DX)+1;% nbre of points in the profile (interval DX)
+               Xproj=linelength/(2*npoint):linelength/npoint:linelength-linelength/(2*npoint);
+               xreg=cos(theta(ip))*Xproj+ObjectData.Coord(ip,1);
+               yreg=sin(theta(ip))*Xproj+ObjectData.Coord(ip,2);
+               if isfield(CellInfo{icell},'VarIndex_vector_x')&&isfield(CellInfo{icell},'VarIndex_vector_y')
+                   VarName_x=FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x};
+                   VarName_y=FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y};
+                   if isfield(CellInfo{icell},'VarIndex_errorflag')
+                       FieldData.(VarName_x)=FieldData.(VarName_x)(indsel);
+                       FieldData.(VarName_y)=FieldData.(VarName_y)(indsel);
+                   end
+                   if ~isfield(CellInfo{icell},'CheckSub') || ~CellInfo{icell}.CheckSub
+                       vector_x_proj=numel(ProjData.ListVarName)+1;
+                       vector_y_proj=numel(ProjData.ListVarName)+2;
+                   end
+               end
+               if isfield(CellInfo{icell},'VarIndex_scalar')
+                   VarName_scalar=FieldData.ListVarName{CellInfo{icell}.VarIndex_scalar};
+                   if isfield(CellInfo{icell},'errorflag') && ~isempty(CellInfo{icell}.errorflag)
+                       FieldData.(VarName_scalar)=FieldData.(VarName_scalar)(indsel);
+                   end
+               end
+               if isfield(CellInfo{icell},'VarIndex_ancillary')% do not project ancillary data with interp
+                   FieldData=rmfield(FieldData,FieldData.ListVarName{CellInfo{icell}.VarIndex_ancillary});
+               end
+               if isfield(CellInfo{icell},'VarIndex_warnflag')% do not project ancillary data with interp
+                   FieldData=rmfield(FieldData,FieldData.ListVarName{CellInfo{icell}.VarIndex_warnflag});
+               end
+               if isfield(CellInfo{icell},'VarIndex_errorflag')% do not project ancillary data with interp
+                   FieldData=rmfield(FieldData,FieldData.ListVarName{CellInfo{icell}.VarIndex_errorflag});
+               end
+               if isequal(ProjMode,'interp_lin')
+               [ProjVar,ListFieldProj,VarAttribute,errormsg]=calc_field_interp([X_sel Y_sel],FieldData,CellInfo{icell}.FieldName,xreg',yreg');
+               else
+                  [ProjVar,ListFieldProj,VarAttribute,errormsg]=calc_field_tps([X_sel Y_sel],FieldData,CellInfo{icell}.FieldName,xreg',yreg');
+               end
+               ivar_vector_x=[];
+               ivar_vector_y=[];
+               for ivar=1:numel(VarAttribute)
+                   if isfield(VarAttribute{ivar},'Role')
+                       if strcmp(VarAttribute{ivar}.Role,'vector_x')
+                       ivar_vector_x=ivar;
+                       elseif strcmp(VarAttribute{ivar}.Role,'vector_y')
+                   ivar_vector_y=ivar;
+                       end
+                   end
+               end
+               if ~isempty(ivar_vector_x)&&~isempty(ivar_vector_y)
+                                  ProjVar{ivar_vector_x}=cos(theta(ip))*ProjVar{ivar_vector_x}+sin(theta(ip))*ProjVar{ivar_vector_y};% longitudinal component
+               ProjVar{ivar_vector_y}=-sin(theta(ip))*ProjVar{ivar_vector_x}+cos(theta(ip))*ProjVar{ivar_vector_y};%transverse component
+               end
+           elseif isequal(ProjMode,'interp_tps') %filtering
+               %   TODO 
+               %                 npoint=floor(linelength/DX)+1;% nbre of points in the profile (interval DX)
+               %                 Xproj=linelength/(2*npoint):linelength/npoint:linelength-linelength/(2*npoint);
+               %                 siz=size(X_sel);
+               %                 xregij=cos(theta(ip))*ones(siz(1),1)*Xproj+ObjectData.Coord(ip,1);
+               %                 yregij=sin(theta(ip))*ones(siz(1),1)*Xproj+ObjectData.Coord(ip,2);
+               %                 xij=X_sel*ones(1,npoint);
+               %                 yij=Y_sel*ones(1,npoint);
+               %                 Aij=exp(-lambda*((xij-xregij).*(xij-xregij)+(yij-yregij).*(yij-yregij)));
+               %                 norm=Aij'*ones(siz(1),1);
+               %                 for ivar=1:numel(ProjVar)
+               %                      if ~isempty(ProjVar{ivar})
+               %                         ProjVar{ivar}=Aij'*ProjVar{ivar}./norm;
+               %
+               %                      end
+               %                 end
+           end
+           %prolongate the total record
+           for ivar=1:numel(ProjVar)
+               if ~isempty(ProjVar{ivar})
+                   if numel(ProjLine)>=ivar
+                       ProjLine{ivar}=[ProjLine{ivar}; ProjVar{ivar}];
+                   else
+                       ProjLine{ivar}=ProjVar{ivar};
+                   end
+               end
+           end
+           XLine=[XLine ;(Xproj+linelengthtot)];%along line abscissa
+           linelengthtot=linelengthtot+linelength;
+           %     circul=circul+(sum(U_sel))*linelength/npoint;
+           %     flux=flux+(sum(V_sel))*linelength/npoint;
+       end
+       ProjData.X=XLine';
+       ProjData.ListVarName=[ProjData.ListVarName {XName}];
+       ProjData.VarDimName=[ProjData.VarDimName {XName}];
+       ProjData.VarAttribute{1}.long_name='abscissa along line';
+       for iselect=1:numel(VarIndex)
+           VarName=FieldData.ListVarName{VarIndex(iselect)};
+           eval(['ProjData.' VarName '=ProjLine{iselect};'])
+           ProjData.ListVarName=[ProjData.ListVarName {VarName}];
+           ProjData.VarDimName=[ProjData.VarDimName {XName}];
+           ProjData.VarAttribute{iselect}=FieldData.VarAttribute{VarIndex(iselect)};
+           if strcmp(ProjMode,'projection')
+               ProjData.VarAttribute{iselect}.Role='discrete';
+           else
+               ProjData.VarAttribute{iselect}.Role='continuous';
+           end
+       end
+       
+       %case of structured coordinates
+   elseif strcmp(CellInfo{icell}.CoordType,'grid')
+       if ~isequal(ObjectData.Type,'line')% exclude polyline
+           errormsg=['no  projection available on ' ObjectData.Type 'for structured coordinates']; %
+       else
+           test_Amat=1;%image or 2D matrix
+           test_interp2=0;%default
+           AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
+           AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};
+           eval(['AX=FieldData.' AXName ';']);% set of x positions
+           eval(['AY=FieldData.' AYName ';']);% set of y positions
+           AName=FieldData.ListVarName{VarIndex(1)};
+           eval(['A=FieldData.' AName ';']);% scalar
+           npxy=size(A);
+           npx=npxy(2);
+           npy=npxy(1);
+           if numel(AX)==2
+               DX=(AX(2)-AX(1))/(npx-1);
+           else
+               DX_vec=diff(AX);
+               DX=max(DX_vec);
+               DX_min=min(DX_vec);
+               if (DX-DX_min)>0.0001*abs(DX)
                    test_interp2=1;
-                    DY=DY_min;
-                end     
-            end              
-            AXI=linspace(AX(1),AX(end), npx);%set of  x  positions for the interpolated input data
-            AYI=linspace(AY(1),AY(end), npy);%set of  x  positions for the interpolated input data
-            if isfield(ObjectData,'DX')
-                DXY_line=ObjectData.DX;%mesh on the projection line
-            else
-                DXY_line=sqrt(abs(DX*DY));% mesh on the projection line
-            end
-            dlinx=ObjectData.Coord(2,1)-ObjectData.Coord(1,1);
-            dliny=ObjectData.Coord(2,2)-ObjectData.Coord(1,2);
-            linelength=sqrt(dlinx*dlinx+dliny*dliny);
-            theta=angle(dlinx+i*dliny);%angle of the line   
-            if isfield(FieldData,'RangeX')
-                XMin=min(FieldData.RangeX);%shift of the origin on the line
-            else
-                XMin=0;
-            end
-            eval(['ProjData.' AXName '=linspace(XMin,XMin+linelength,linelength/DXY_line+1);'])%abscissa of the new pixels along the line
-            y=linspace(-width,width,2*width/DXY_line+1);%ordintes of the new pixels (coordinate across the line)
-            eval(['npX=length(ProjData.' AXName ');'])
-            npY=length(y); %TODO: utiliser proj_grid
-            eval(['[X,Y]=meshgrid(ProjData.' AXName ',y);'])%grid in the line coordinates
-            XIMA=ObjectData.Coord(1,1)+(X-XMin)*cos(theta)-Y*sin(theta);
-            YIMA=ObjectData.Coord(1,2)+(X-XMin)*sin(theta)+Y*cos(theta);
-            XIMA=(XIMA-AX(1))/DX+1;%  index of the original image along x
-            YIMA=(YIMA-AY(1))/DY+1;% index of the original image along y
-            XIMA=reshape(round(XIMA),1,npX*npY);%indices reorganized in 'line'
-            YIMA=reshape(round(YIMA),1,npX*npY);
-            flagin=XIMA>=1 & XIMA<=npx & YIMA >=1 & YIMA<=npy;%flagin=1 inside the original image
-            ind_in=find(flagin);
-            ind_out=find(~flagin);
-            ICOMB=(XIMA-1)*npy+YIMA;
-            ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A
-            nbcolor=1; %color images
-            if numel(npxy)==2
-                nbcolor=1;
-            elseif length(npxy)==3
-                nbcolor=npxy(3);
-            else
-                errormsg='multicomponent field not projected';
-                display(errormsg)
-                return
-            end 
-            nbvar=length(ProjData.ListVarName);% number of var from previous cells
-            ProjData.ListVarName=[ProjData.ListVarName {AXName}];
-            ProjData.VarDimName=[ProjData.VarDimName {AXName}];
-            for ivar=VarIndex
-                %VarName{ivar}=FieldData.ListVarName{ivar};
-                if test_interp2% interpolate on new grid
-                    FieldData.(FieldData.ListVarName{ivar})=interp2(FieldData.(AXName),FieldData.(AYName),FieldData.(FieldData.ListVarName{ivar}),AXI,AYI);%TO TEST
-                end
-                vec_A=reshape(squeeze(FieldData.(FieldData.ListVarName{ivar})),npx*npy,nbcolor); %put the original image in colum
-                if nbcolor==1
-                    vec_B(ind_in)=vec_A(ICOMB);
-                    vec_B(ind_out)=zeros(size(ind_out));
-                    A_out=reshape(vec_B,npY,npX);
-                    ProjData.(FieldData.ListVarName{ivar}) =sum(A_out,1)/npY;
-                elseif nbcolor==3
-                    vec_B(ind_in,1:3)=vec_A(ICOMB,:);
-                    vec_B(ind_out,1)=zeros(size(ind_out));
-                    vec_B(ind_out,2)=zeros(size(ind_out));
-                    vec_B(ind_out,3)=zeros(size(ind_out));
-                    A_out=reshape(vec_B,npY,npX,nbcolor);
-                    ProjData.(FieldData.ListVarName{ivar})=squeeze(sum(A_out,1)/npY);
-                end  
-                ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}];
-                ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate
-                ProjData.VarAttribute{ivar}.Role='continuous';% for plot with continuous line
-            end
-            if testU
-                 vector_x =ProjData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x});
-                 vector_y =ProjData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y});
-                 ProjData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x}) =cos(theta)*vector_x+sin(theta)*vector_y;
-                 ProjData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y}) =-sin(theta)*vector_x+cos(theta)*vector_y;
-            end
-            ProjData.VarAttribute{nbvar+1}.long_name='abscissa along line';
-            if nbcolor==3
-                ProjData.VarDimName{end}={AXName,'rgb'};
-            end
-        end
-    elseif strcmp(CellInfo{icell}.CoordType,'tps')
-         if isfield(ObjectData,'DX')&~isempty(ObjectData.DX)
-                DX=abs(ObjectData.DX);%mesh of interpolation points along the line
-                Xproj=linelength/(2*npoint):linelength/npoint:linelength-linelength/(2*npoint);
-                xreg=cos(theta(ip))*Xproj+ObjectData.Coord(ip,1)
-                yreg=sin(theta(ip))*Xproj+ObjectData.Coord(ip,2)
-%                 coord_x_proj=XMin:DX:XMax;
-%                 coord_y_proj=YMin:DY:YMax;
-                DataOut=calc_field_tps(FieldData.FieldList,FieldData,cat(3,xreg,yreg));
-                ProjData.ListVarName=[ProjData.ListVarName DataOut.ListVarName];
-                ProjData.VarDimName=[ProjData.VarDimName DataOut.VarDimName];
-                ProjData.VarAttribute=[ProjData.VarAttribute DataOut.VarAttribute];   
-                DataOut.ListVarName(1)=[];
-                DataOut.VarDimName(1)=[];
-                DataOut.VarAttribute(1)=[];
-                for ilist=2:length(DataOut.ListVarName)% reshape data, excluding coordinates (ilist=1-2), TODO: rationalise
-                    VarName=DataOut.ListVarName{ilist};
-                     ProjData.(VarName)=DataOut.(VarName);
-                end
-                ProjData.coord_x=Xproj;
-         end
-    end
+                   DX=DX_min;
+               end
+           end
+           if numel(AY)==2
+               DY=(AY(2)-AY(1))/(npy-1);
+           else
+               DY_vec=diff(AY);
+               DY=max(DY_vec);
+               DY_min=min(DY_vec);
+               if (DY-DY_min)>0.0001*abs(DY)
+                   test_interp2=1;
+                   DY=DY_min;
+               end
+           end
+           AXI=linspace(AX(1),AX(end), npx);%set of  x  positions for the interpolated input data
+           AYI=linspace(AY(1),AY(end), npy);%set of  x  positions for the interpolated input data
+           if isfield(ObjectData,'DX')
+               DXY_line=ObjectData.DX;%mesh on the projection line
+           else
+               DXY_line=sqrt(abs(DX*DY));% mesh on the projection line
+           end
+           dlinx=ObjectData.Coord(2,1)-ObjectData.Coord(1,1);
+           dliny=ObjectData.Coord(2,2)-ObjectData.Coord(1,2);
+           linelength=sqrt(dlinx*dlinx+dliny*dliny);
+           theta=angle(dlinx+i*dliny);%angle of the line
+           if isfield(FieldData,'RangeX')
+               XMin=min(FieldData.RangeX);%shift of the origin on the line
+           else
+               XMin=0;
+           end
+           eval(['ProjData.' AXName '=linspace(XMin,XMin+linelength,linelength/DXY_line+1);'])%abscissa of the new pixels along the line
+           y=linspace(-width,width,2*width/DXY_line+1);%ordintes of the new pixels (coordinate across the line)
+           eval(['npX=length(ProjData.' AXName ');'])
+           npY=length(y); %TODO: utiliser proj_grid
+           eval(['[X,Y]=meshgrid(ProjData.' AXName ',y);'])%grid in the line coordinates
+           XIMA=ObjectData.Coord(1,1)+(X-XMin)*cos(theta)-Y*sin(theta);
+           YIMA=ObjectData.Coord(1,2)+(X-XMin)*sin(theta)+Y*cos(theta);
+           XIMA=(XIMA-AX(1))/DX+1;%  index of the original image along x
+           YIMA=(YIMA-AY(1))/DY+1;% index of the original image along y
+           XIMA=reshape(round(XIMA),1,npX*npY);%indices reorganized in 'line'
+           YIMA=reshape(round(YIMA),1,npX*npY);
+           flagin=XIMA>=1 & XIMA<=npx & YIMA >=1 & YIMA<=npy;%flagin=1 inside the original image
+           ind_in=find(flagin);
+           ind_out=find(~flagin);
+           ICOMB=(XIMA-1)*npy+YIMA;
+           ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A
+           nbcolor=1; %color images
+           if numel(npxy)==2
+               nbcolor=1;
+           elseif length(npxy)==3
+               nbcolor=npxy(3);
+           else
+               errormsg='multicomponent field not projected';
+               display(errormsg)
+               return
+           end
+           nbvar=length(ProjData.ListVarName);% number of var from previous cells
+           ProjData.ListVarName=[ProjData.ListVarName {AXName}];
+           ProjData.VarDimName=[ProjData.VarDimName {AXName}];
+           for ivar=VarIndex
+               %VarName{ivar}=FieldData.ListVarName{ivar};
+               if test_interp2% interpolate on new grid
+                   FieldData.(FieldData.ListVarName{ivar})=interp2(FieldData.(AXName),FieldData.(AYName),FieldData.(FieldData.ListVarName{ivar}),AXI,AYI);%TO TEST
+               end
+               vec_A=reshape(squeeze(FieldData.(FieldData.ListVarName{ivar})),npx*npy,nbcolor); %put the original image in colum
+               if nbcolor==1
+                   vec_B(ind_in)=vec_A(ICOMB);
+                   vec_B(ind_out)=zeros(size(ind_out));
+                   A_out=reshape(vec_B,npY,npX);
+                   ProjData.(FieldData.ListVarName{ivar}) =sum(A_out,1)/npY;
+               elseif nbcolor==3
+                   vec_B(ind_in,1:3)=vec_A(ICOMB,:);
+                   vec_B(ind_out,1)=zeros(size(ind_out));
+                   vec_B(ind_out,2)=zeros(size(ind_out));
+                   vec_B(ind_out,3)=zeros(size(ind_out));
+                   A_out=reshape(vec_B,npY,npX,nbcolor);
+                   ProjData.(FieldData.ListVarName{ivar})=squeeze(sum(A_out,1)/npY);
+               end
+               ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}];
+               ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate
+               ProjData.VarAttribute{ivar}.Role='continuous';% for plot with continuous line
+           end
+           if testU
+               vector_x =ProjData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x});
+               vector_y =ProjData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y});
+               ProjData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x}) =cos(theta)*vector_x+sin(theta)*vector_y;
+               ProjData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y}) =-sin(theta)*vector_x+cos(theta)*vector_y;
+           end
+           ProjData.VarAttribute{nbvar+1}.long_name='abscissa along line';
+           if nbcolor==3
+               ProjData.VarDimName{end}={AXName,'rgb'};
+           end
+       end
+   elseif strcmp(CellInfo{icell}.CoordType,'tps')
+       if isfield(ObjectData,'DX')&~isempty(ObjectData.DX)
+           DX=abs(ObjectData.DX);%mesh of interpolation points along the line
+           Xproj=linelength/(2*npoint):linelength/npoint:linelength-linelength/(2*npoint);
+           xreg=cos(theta(ip))*Xproj+ObjectData.Coord(ip,1)
+           yreg=sin(theta(ip))*Xproj+ObjectData.Coord(ip,2)
+           %                 coord_x_proj=XMin:DX:XMax;
+           %                 coord_y_proj=YMin:DY:YMax;
+           DataOut=calc_field_tps(FieldData.FieldList,FieldData,cat(3,xreg,yreg));
+           ProjData.ListVarName=[ProjData.ListVarName DataOut.ListVarName];
+           ProjData.VarDimName=[ProjData.VarDimName DataOut.VarDimName];
+           ProjData.VarAttribute=[ProjData.VarAttribute DataOut.VarAttribute];
+           DataOut.ListVarName(1)=[];
+           DataOut.VarDimName(1)=[];
+           DataOut.VarAttribute(1)=[];
+           for ilist=2:length(DataOut.ListVarName)% reshape data, excluding coordinates (ilist=1-2), TODO: rationalise
+               VarName=DataOut.ListVarName{ilist};
+               ProjData.(VarName)=DataOut.(VarName);
+           end
+           ProjData.coord_x=Xproj;
+       end
+   end
 end
 
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 643)
+++ /trunk/src/series.m	(revision 644)
@@ -1073,31 +1073,42 @@
 
 %% set the waitbar position with respect to the min and max in the series
-for iview=1:numel(SeriesData.i1_series)
-    pair_max{iview}=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index
-    if (strcmp(get(handles.num_first_j,'Visible'),'off')&& size(pair_max{iview},2)~=1)
-        pair_max{iview}=squeeze(max(pair_max{iview},[],1)); % consider only the i index
-    end
-    pair_max{iview}=reshape(pair_max{iview},1,[]);
-    index_min(iview)=find(pair_max{iview}>0, 1 );
-    index_max(iview)=find(pair_max{iview}>0, 1, 'last' );
-end
-[index_min,iview_min]=min(index_min);
-[index_max,iview_max]=min(index_max);
-if size(SeriesData.i1_series{iview_min},2)==1% movie
-    index_first=ref_i(1);
-    index_last=ref_i(2);
-else
-    index_first=(ref_i(1)-1)*(size(SeriesData.i1_series{iview_min},1))+ref_j(1)+1;
-    index_last=(ref_i(2)-1)*(size(SeriesData.i1_series{iview_max},1))+ref_j(2)+1;
-end
-range=index_max-index_min+1;
-coeff_min=(index_first-index_min)/range;
-coeff_max=(index_last-index_min+1)/range;
+MinIndex_i=min(get(handles.MinIndex_i,'Data'));
+MaxIndex_i=max(get(handles.MaxIndex_i,'Data'));
+pos_first=(ref_i(1)-MinIndex_i)/(MaxIndex_i-MinIndex_i+1);
+pos_last=(ref_i(2)-MinIndex_i+1)/(MaxIndex_i-MinIndex_i+1);
 Position=get(handles.Waitbar,'Position');% position of the waitbar:= [ x,y, width, height]
 Position_status=get(handles.FileStatus,'Position');
-Position(1)=coeff_min*Position_status(3)+Position_status(1);
-Position(3)=Position_status(3)*(coeff_max-coeff_min);
+Position(1)=Position_status(1)+Position_status(3)*pos_first;
+Position(3)=Position_status(3)*(pos_last-pos_first);
 set(handles.Waitbar,'Position',Position)
 update_waitbar(handles.Waitbar,0)
+
+% for iview=1:numel(SeriesData.i1_series)
+%     pair_max{iview}=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index
+%     if (strcmp(get(handles.num_first_j,'Visible'),'off')&& size(pair_max{iview},2)~=1)
+%         pair_max{iview}=squeeze(max(pair_max{iview},[],1)); % consider only the i index
+%     end
+%     pair_max{iview}=reshape(pair_max{iview},1,[]);
+%     index_min(iview)=find(pair_max{iview}>0, 1 );
+%     index_max(iview)=find(pair_max{iview}>0, 1, 'last' );
+% end
+% [index_min,iview_min]=min(index_min);
+% [index_max,iview_max]=min(index_max);
+% if size(SeriesData.i1_series{iview_min},2)==1% movie
+%     index_first=ref_i(1);
+%     index_last=ref_i(2);
+% else
+%     index_first=(ref_i(1)-1)*(size(SeriesData.i1_series{iview_min},1))+ref_j(1)+1;
+%     index_last=(ref_i(2)-1)*(size(SeriesData.i1_series{iview_max},1))+ref_j(2)+1;
+% end
+% range=index_max-index_min+1;
+% coeff_min=(index_first-index_min)/range;
+% coeff_max=(index_last-index_min+1)/range;
+% Position=get(handles.Waitbar,'Position');% position of the waitbar:= [ x,y, width, height]
+% Position_status=get(handles.FileStatus,'Position');
+% Position(1)=coeff_min*Position_status(3)+Position_status(1);
+% Position(3)=Position_status(3)*(coeff_max-coeff_min);
+% set(handles.Waitbar,'Position',Position)
+% update_waitbar(handles.Waitbar,0)
 
 %------------------------------------------------------------------------
@@ -1370,4 +1381,6 @@
 set(handles.RUN,'BackgroundColor',[1 1 0])%show activation of RUN by yellow color
 drawnow
+set(handles.status,'Value',0)% desable status display if relevant
+status_Callback(hObject, eventdata, handles)
 
 %% read the data on the GUI series
@@ -1832,4 +1845,8 @@
 end
 set(handles.ActionName,'BackgroundColor',[1 1 0])
+huigetfile=findobj(allchild(0),'tag','status_display')
+if ~isempty(huigetfile)
+    delete(huigetfile)
+end
 drawnow
 
@@ -2598,28 +2615,8 @@
     OutputDir=fullfile(RootPath,OutputSubDir);
     uigetfile_uvmat('status_display',OutputDir)
-    
-%     hfig=findobj(allchild(0),'name','series_status');
-%     if isempty(hfig)
-%         ScreenSize=get(0,'ScreenSize');
-%         hfig=figure('DeleteFcn',@stop_status,'Position',[ScreenSize(3)-600 ScreenSize(4)-640 560 600]);
-%         set(hfig,'MenuBar','none')% suppress the menu bar
-%         set(hfig,'NumberTitle','off')%suppress the fig number in the title
-%         set(hfig,'name','series_status')
-%         set(hfig,'tag','series_status')
-%         uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @view_file,'tag','list','UserData',OutputDir);
-%         uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','titlebox','Max',2,'String',OutputDir);
-%         uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]);
-%         uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status);
-%         uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI);
-%         %set(hrefresh,'UserData',StatusData)
-%         BarPosition=[0.05 0.81 0.01 0.05];
-%         uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar');
-%         drawnow
-%     end
-%     refresh_GUI(hfig) 
 else
     %% delete current display fig if selection is off
     set(handles.status,'BackgroundColor',[0 1 0])
-    hfig=findobj(allchild(0),'name','series_status');
+    hfig=findobj(allchild(0),'name','status_display');
     if ~isempty(hfig)
         delete(hfig)
Index: /trunk/src/uigetfile_uvmat.m
===================================================================
--- /trunk/src/uigetfile_uvmat.m	(revision 643)
+++ /trunk/src/uigetfile_uvmat.m	(revision 644)
@@ -128,5 +128,5 @@
         NbOutputFile_str=num2str(NbOutputFile);
     end
-    [ListFiles,NumFiles]=list_files(DirName,1,TimeStart,FilterExt);% list the directory content
+    [ListFiles,NumFiles]=list_files(DirName,1,TimeStart);% list the directory content
     
     %% update the waitbar
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 643)
+++ /trunk/src/uvmat.m	(revision 644)
@@ -194,5 +194,5 @@
 
 %UvData.OpenParam.PosColorbar=[0.8450    0.0900    0.0190    0.3600];
-UvData.OpenParam.PosColorbar=[0.805 0.022 0.019 0.445];
+UvData.OpenParam.PosColorbar=[0.80 0.02 0.018 0.445];
 %UvData.OpenParam.PosSetObject=[-0.05 -0.03 0.3 0.7]; %position for set_object
 UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib (TO IMPROVE)
@@ -210,4 +210,5 @@
 set(hObject,'WindowButtonUpFcn',{'mouse_up',handles}) 
 set(hObject,'DeleteFcn',{@closefcn})%
+set(hObject,'ResizeFcn',{@ResizeFcn,handles})%
 
 %% initialisation
@@ -334,4 +335,86 @@
     set(hhh,'enable','off')
 end
+
+%------------------------------------------------------------------------
+%--- activated when resizing the GUI view_field
+ function ResizeFcn(gcbo,eventdata,handles)
+%------------------------------------------------------------------------     
+set(handles.uvmat,'Units','pixels')
+size_fig=get(handles.uvmat,'Position');
+ColumnWidth=max(150,0.18*size_fig(3));
+ColumnWidth=min(ColumnWidth,250); % width of the right side display column, between 150 and 250, depending on the fig width
+% Data=get(handles.uvmat,'UserData');
+% Data.GUISize=size_fig;
+% set(handles.uvmat,'UserData',Data)
+
+
+%% position of panel InputFile
+%set(handles.InputFile,'Units','pixels')
+pos_InputFile=get(handles.InputFile,'Position');% [lower x lower y width height] for text_display
+pos_InputFile(1)=0;
+pos_InputFile(2)=size_fig(4)-pos_InputFile(4);             % set frame InputFile to the top of the fig
+pos_InputFile(3)=size_fig(3);
+
+set(handles.InputFile,'Position',pos_InputFile);% [lower x lower y width height] for text_display
+
+%% reset position of text_display or TableDisplay
+if strcmp(get(handles.TableDisplay,'Visible'),'off')
+    pos_1=get(handles.text_display,'Position');% [lower x lower y width height] for text_display
+        pos_1(3)=1.2*ColumnWidth;
+    pos_1(1)=size_fig(3)-pos_1(3);             % set text display to the right of the fig
+    pos_1(2)=size_fig(4)-pos_InputFile(4)-pos_1(4);             % set text display to the top of the fig
+    set(handles.text_display,'Position',pos_1)
+    % reset position of TableDisplay
+else
+    pos_1=get(handles.TableDisplay,'Position');
+    pos_1(3)=1.2*ColumnWidth;
+    pos_1(1)=size_fig(3)-pos_1(3);
+    pos_1(2)=size_fig(4)-pos_InputFile(4)-pos_1(4);
+    set(handles.TableDisplay,'Position',pos_1)
+end
+
+%% reset position of CheckHold
+% pos_CheckHold=get(handles.CheckHold,'Position');% [lower x lower y width height] for CheckHold
+% pos_CheckHold(1)=size_fig(3)-pos_CheckHold(3);       % set 'CheckHold' to the right of the fig
+% pos_CheckHold(2)=pos_1(2)-pos_CheckHold(4);          % set 'CheckHold' to the lower edge of text display
+% set(handles.CheckHold,'Position',pos_CheckHold)
+
+%% reset position of Coordinates
+pos_2=get(handles.Coordinates,'Position');% [lower x lower y width height] for frame 'Coordinates'
+pos_2(3)=ColumnWidth;
+pos_2(1)=size_fig(3)-pos_2(3);       % set 'Coordinates' to the right of the fig
+pos_2(2)=pos_1(2)-pos_2(4);          % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold
+set(handles.Coordinates,'Position',pos_2)
+
+%% reset position of  Scalar
+pos_3=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar'
+pos_3(3)=ColumnWidth;
+pos_3(1)=size_fig(3)-pos_3(3);         % set 'Scalar' to the right of the fig
+if strcmp(get(handles.Scalar,'Visible'),'on')
+    pos_3(2)=pos_2(2)-pos_3(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
+else
+    pos_3(2)=pos_2(2);% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
+end
+set(handles.Scalar,'Position',pos_3)
+
+%% reset position of  Vectors
+set(handles.Vectors,'Units','pixels')
+pos_4=get(handles.Vectors,'Position');
+pos_4(3)=ColumnWidth;
+pos_4(1)=size_fig(3)-pos_4(3);
+if strcmp(get(handles.Vectors,'visible'),'on')
+    pos_4(2)=pos_3(2)-pos_4(4);
+else
+    pos_4(2)=pos_3(2);
+end
+set(handles.Vectors,'Position',pos_4)
+
+%% reset position and scale of axis
+pos(1)=0.2*size_fig(3)+35;
+pos(2)=35;
+pos(3)=0.77*size_fig(3)-1.2*ColumnWidth;
+pos(4)=size_fig(4)-60;
+set(handles.PlotAxes,'Position',pos)
+
 
 %------------------------------------------------------------------------
@@ -1103,5 +1186,5 @@
 set(handles.j2,'Visible',state_j)
 set(handles.last_j,'Visible',state_j);
-set(handles.frame_j,'Visible',state_j);
+%set(handles.frame_j,'Visible',state_j);
 set(handles.j_text,'Visible',state_j);
 if ~isempty(i2_series)||~isempty(j2_series)
@@ -2749,4 +2832,5 @@
     end
 end
+ResizeFcn(handles.uvmat,[],handles)
 
 %------------------------------------------------------------------------
@@ -2984,5 +3068,8 @@
     if strcmp(transform_fct,'sub_field')
         set(handles.TransformName,'Value',1)%suppress the sub_field transform
-        transform_fct_Callback(hObject, eventdata, handles); 
+        T
+        
+        
+        ransformName_Callback(hObject, eventdata, handles); 
     else
         run0_Callback(hObject, eventdata, handles)
@@ -4175,5 +4262,5 @@
         set(hview_field,'UserData',Data);% restore the previously stored GUI position after GUI resizing
     else
-        set(hview_field,'Position',Data.GUISize)% return to the previously stored GUI position and size
+%         set(hview_field,'Position',Data.GUISize)% return to the previously stored GUI position and size
     end
 end
@@ -4349,5 +4436,5 @@
     else
         Data=get(hview_field,'UserData');
-        set(hview_field,'Position',Data.GUISize)% restore the size of view_field for plots
+%         set(hview_field,'Position',Data.GUISize)% restore the size of view_field for plots
     end
 else
Index: /trunk/src/view_field.m
===================================================================
--- /trunk/src/view_field.m	(revision 643)
+++ /trunk/src/view_field.m	(revision 644)
@@ -101,4 +101,5 @@
 %put the GUI on the lower right of the sceen
 pos_view_field=get(hObject,'Position');
+set(0,'Unit','pixel')
 ScreenSize=get(0,'ScreenSize');
 pos_view_field(1)=ScreenSize(1)+ScreenSize(3)-pos_view_field(3);
@@ -118,7 +119,7 @@
 %% reset position of text_display or TableDisplay
 if strcmp(get(handles.TableDisplay,'Visible'),'off')
-    pos_1=get(handles.text_display,'Position');
-    pos_1(1)=size_fig(3)-pos_1(3);
-    pos_1(2)=size_fig(4)-pos_1(4);
+    pos_1=get(handles.text_display,'Position');% [lower x lower y width height] for text_display
+    pos_1(1)=size_fig(3)-pos_1(3);             % set text display to the right of the fig
+    pos_1(2)=size_fig(4)-pos_1(4);             % set text display to the top of the fig
     set(handles.text_display,'Position',pos_1)
     % reset position of TableDisplay
@@ -130,17 +131,23 @@
 end
 
+%% reset position of CheckHold
+pos_CheckHold=get(handles.CheckHold,'Position');% [lower x lower y width height] for CheckHold
+pos_CheckHold(1)=size_fig(3)-pos_CheckHold(3);       % set 'CheckHold' to the right of the fig
+pos_CheckHold(2)=pos_1(2)-pos_CheckHold(4);          % set 'CheckHold' to the lower edge of text display
+set(handles.CheckHold,'Position',pos_CheckHold)
+
 %% reset position of Coordinates
-pos_2=get(handles.Coordinates,'Position');
-pos_2(1)=size_fig(3)-pos_1(3);
-pos_2(2)=pos_1(2)-pos_2(4);
+pos_2=get(handles.Coordinates,'Position');% [lower x lower y width height] for frame 'Coordinates'
+pos_2(1)=size_fig(3)-pos_2(3);       % set 'Coordinates' to the right of the fig
+pos_2(2)=pos_CheckHold(2)-pos_2(4);          % set 'Coordinates' to the lower edge of text display, allowing a margin for CheckHold
 set(handles.Coordinates,'Position',pos_2)
 
 %% reset position of  Scalar
-pos_3=get(handles.Scalar,'Position');
-pos_3(1)=size_fig(3)-pos_3(3);
+pos_3=get(handles.Scalar,'Position'); % [lower x lower y width height] for frame 'Scalar'
+pos_3(1)=size_fig(3)-pos_3(3);         % set 'Scalar' to the right of the fig
 if strcmp(get(handles.Scalar,'visible'),'on')
-    pos_3(2)=pos_2(2)-pos_3(4);
+    pos_3(2)=pos_2(2)-pos_3(4); % set 'Scalar' to the lower edge of frame 'Coordinates' if visible
 else
-    pos_3(2)=pos_2(2);
+    pos_3(2)=pos_2(2);% set 'Scalar' to the lower edge of frame 'text display' if  unvisible
 end
 set(handles.Scalar,'Position',pos_3)
@@ -834,15 +841,2 @@
 function num_ColCode2_Callback(hObject, eventdata, handles)
 
-
-
-% 
-% 
-% % --- Executes when view_field is resized.
-% function view_field_ResizeFcn(hObject, eventdata, handles)
-% % hObject    handle to view_field (see GCBO)
-% % eventdata  reserved - to be defined in a future version of MATLAB
-% % handles    structure with handles and user data (see GUIDATA)
-
-
-
-
