Index: trunk/src/proj_field.m
===================================================================
--- trunk/src/proj_field.m	(revision 1072)
+++ trunk/src/proj_field.m	(revision 1077)
@@ -719,11 +719,11 @@
                     ProjData.VarAttribute{nbvar+ivar}=FieldData.VarAttribute{VarIndex(ivar)};%reproduce var attribute
                     if isfield(ProjData.VarAttribute{nbvar+ivar},'Role')
-                        if  strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x');
+                        if  strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_x')
                             ivar_U=nbvar+ivar;
-                        elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y');
+                        elseif strcmp(ProjData.VarAttribute{nbvar+ivar}.Role,'vector_y')
                             ivar_V=nbvar+ivar;
                         end
                     end
-                    ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles with continuoval(['us lines
+                    ProjData.VarAttribute{ivar+nbvar}.Role='discrete';% will promote plots of the profiles as a  set of individual dots
                 end
             elseif isequal(ProjMode,'interp_lin')  %filtering %linear interpolation:
@@ -756,7 +756,7 @@
                     ProjData.VarDimName=[ProjData.VarDimName {XName}];
                     if isfield(VarAttribute{ivar},'Role')
-                        if  strcmp(VarAttribute{ivar}.Role,'vector_x');
+                        if  strcmp(VarAttribute{ivar}.Role,'vector_x')
                             ivar_U=ivar+nbvar;
-                        elseif strcmp(VarAttribute{ivar}.Role,'vector_y');
+                        elseif strcmp(VarAttribute{ivar}.Role,'vector_y')
                             ivar_V=ivar+nbvar;
                         end
@@ -787,7 +787,7 @@
                     ProjData.VarDimName=[ProjData.VarDimName {'X'}];
                     if isfield(VarAttribute{ivar},'Role')
-                        if  strcmp(VarAttribute{ivar}.Role,'vector_x');
+                        if  strcmp(VarAttribute{ivar}.Role,'vector_x')
                             ivar_U=ivar+nbvar;
-                        elseif strcmp(VarAttribute{ivar}.Role,'vector_y');
+                        elseif strcmp(VarAttribute{ivar}.Role,'vector_y')
                             ivar_V=ivar+nbvar;
                         end
@@ -813,5 +813,5 @@
                 AY=FieldData.(AYName);% set of y positions
                 AZ=FieldData.(AZName);% set of z positions
-                 AName=FieldData.ListVarName{VarIndex(1)};
+                AName=FieldData.ListVarName{VarIndex(1)};
                 npxy=size(FieldData.(AName));
                 npz=npxy(1);
@@ -820,23 +820,23 @@
                 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
-                 AZI=linspace(AZ(1),AZ(end), npy);%set of  x  positions for the interpolated input data
+                AZI=linspace(AZ(1),AZ(end), npy);%set of  x  positions for the interpolated input data
                 for ivar=VarIndex
                     VarName=FieldData.ListVarName{ivar};
                     FieldData.(VarName)=interp3(FieldData.(AXName),FieldData.(AYName),FieldData.(AZName),FieldData.(VarName),AXI,AYI,AZI);
-
-%                     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
+                    
+                    %                     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
@@ -941,7 +941,19 @@
                     ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName{ivar}];
                     ProjData.VarDimName=[ProjData.VarDimName {AXName}];%to generalize with the initial name of the x coordinate
-                    nbvar=nbvar+1;
-                    ProjData.VarAttribute{nbvar}.Role='coord_y';% for plot with continuous line
-                end
+                    nbvar_proj=numel(ProjData.ListVarName);
+                    if isfield(FieldData.VarAttribute{ivar},'Role')
+                        if  strcmp(FieldData.VarAttribute{ivar}.Role,'vector_x')
+                            ivar_U=nbvar_proj;
+                        elseif strcmp(FieldData.VarAttribute{ivar}.Role,'vector_y')
+                            ivar_V=nbvar_proj;
+                        end
+                    end
+                    if isequal(ProjMode,'projection')
+                        ProjData.VarAttribute{nbvar_proj}.Role='discrete';
+                    else
+                        ProjData.VarAttribute{nbvar_proj}.Role='coord_y';
+                    end
+                end
+                
                 if nbcolor==3
                     ProjData.VarDimName{end}={AXName,'rgb'};
@@ -950,9 +962,10 @@
             
     end
-if ~isempty(ivar_U) && ~isempty(ivar_V)
-    vector_x =ProjData.(ProjData.ListVarName{ivar_U});
-    ProjData.(ProjData.ListVarName{ivar_U}) =cos(theta)*vector_x+sin(theta)*ProjData.(ProjData.ListVarName{ivar_V});
-    ProjData.(ProjData.ListVarName{ivar_V}) =-sin(theta)*vector_x+cos(theta)*ProjData.(ProjData.ListVarName{ivar_V});
-end
+    % for vector fields, take the components longitudinal and tranverse to the projection line
+    if ~isempty(ivar_U) && ~isempty(ivar_V)
+        vector_x =ProjData.(ProjData.ListVarName{ivar_U});
+        ProjData.(ProjData.ListVarName{ivar_U}) =cos(theta)*vector_x+sin(theta)*ProjData.(ProjData.ListVarName{ivar_V});
+        ProjData.(ProjData.ListVarName{ivar_V}) =-sin(theta)*vector_x+cos(theta)*ProjData.(ProjData.ListVarName{ivar_V});
+    end
 end
 
@@ -1175,5 +1188,5 @@
         AYName='coord_y';
         AXName='coord_x';
-        if strcmp(ObjectData.ProjMode,'projection')||strcmp(ObjectData.Type,'plane')
+        if strcmp(ObjectData.ProjMode,'projection')%||strcmp(ObjectData.Type,'plane')
             ProjData.coord_y=[FieldData.YMin FieldData.YMax];%note that if projection is done on a grid, the Min and Max along each direction must have been defined
             ProjData.coord_x=[FieldData.XMin FieldData.XMax];
