Index: trunk/src/read_get_field.m
===================================================================
--- trunk/src/read_get_field.m	(revision 19)
+++ trunk/src/read_get_field.m	(revision 32)
@@ -1,3 +1,11 @@
-%'read_get_field': read the list of selected variables from the GUI get_field (SAME AS THE FIRST
+%'read_get_field': read the list of selected variables from the GUI get_field 
+
+% OUTPUT:
+% SubField: structure with fields 
+   %  .ListVarName: list of selected variables
+   %  .VarDimName: cells with the  corresponding dimension names
+   %  .Field1, 2...: if an input file has been opened by get_field
+% errormsg: error message (=[] when no error)
+
 % INPUT: 
 % hget_field: handles of the GUI get_field
@@ -34,6 +42,9 @@
 dim_vec_z=0;
 c_index=[];
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%  ordinary (1D) plot
 if test_1Dplot
-     % select ordinate variable(s)
+    % select ordinate variable(s)
     inputlist=get(handles.ordinate,'String'); 
     val=get(handles.ordinate,'Value');% selection(s) for ordinate
@@ -42,7 +53,4 @@
         VarIndex_y(ilist)=name2index(VarNameCell{ilist},Field.ListVarName);%index of the variable in ListVarName
         dim_ordinate{ilist}=Field.VarDimName{VarIndex_y(ilist)};% name of the corresponding dimension
-%         if iscell(dim_ordinate{ilist})
-%             dim_ordinate{ilist}=dim_ordinate{ilist}{1};%take the first dimension name (char chain) in case of a matrix
-%         end
         testpermute(ilist)=0;%default
         nbvar=nbvar+1;
@@ -56,5 +64,5 @@
     end
     
-        % select abscissa variable
+    % select abscissa variable
     inputlist=get(handles.abscissa,'String'); 
     val=get(handles.abscissa,'Value');% a single selection is expected for abscissa
@@ -95,9 +103,9 @@
     end
 end
-
 test3D=strcmp(get(handles.coord_z_scalar,'Visible'),'on')||strcmp(get(handles.coord_z_vectors,'Visible'),'on');
 VarSubIndexA=[];
 
-%scalar variable
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%scalar field
 test_xdimvar=0;%default
 test_ydimvar=0;%default
@@ -233,4 +241,7 @@
    end
 end
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% vectors
 test_vec_x_dimvar=0;%default
 test_vec_y_dimvar=0;%default
@@ -278,8 +289,7 @@
         SubVarAttribute{nbvar}=VarAttribute{VarIndexV};
     end
-    SubVarAttribute{nbvar}.Role='vector_y';
-    
+    SubVarAttribute{nbvar}.Role='vector_y';    
  
-     % select x variable for vector
+    % select x variable for vector
     inputlist=get(handles.coord_x_vectors,'String'); 
     val=get(handles.coord_x_vectors,'Value');% a single selection is expected for abscissa
@@ -287,5 +297,4 @@
     VarIndex=name2index(VarName,Field.ListVarName);%index of the variable in ListVarName
     if isempty(VarIndex)% default abscissa = matrix indexTODO like scalar
-%         coord_x_name=dimname_u{2};% name of the x coordinate = dimension of the plotted quantity
         empty_coord_vec_x=1;
     else
@@ -315,5 +324,5 @@
     end
         
-         % select y variable for vector
+     % select y variable for vector
     inputlist=get(handles.coord_y_vectors,'String'); 
     val=get(handles.coord_y_vectors,'Value');% a single selection is expected for abscissa
@@ -321,5 +330,4 @@
     VarIndex=name2index(VarName,Field.ListVarName);%index of the variable in ListVarName
     if isempty(VarIndex)% default abscissa = matrix indexTODO like scalar
-%         coord_x_name=dimname_u{2};% name of the x coordinate = dimension of the plotted quantity
         empty_coord_vec_y=1;
     else
@@ -383,7 +391,6 @@
         end        
     end   
-        
-      
-     if test3D %  (a revoir)  
+            
+    if test3D %  (a revoir)  
          %scalar w variable
         inputlist=get(handles.vector_z,'String');
@@ -428,4 +435,5 @@
     end
 end 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 % get the input field
@@ -434,4 +442,5 @@
     SubField=nc2struct(inputfield,ListVarName);
 else  % subfield stored in memory
+    SubField.ListGlobalAttribute={};
     SubField.ListVarName=ListVarName;
     SubField.VarDimName=VarDimName;
@@ -441,5 +450,5 @@
 SubField.VarAttribute=SubVarAttribute;
 
-%permute indices if coord_y is not the first matrix index
+%permute indices if coord_y is not the first matrix index: scalar case
 if test_scalar
     VarNameA=Field.ListVarName{VarIndexA};
@@ -560,9 +569,9 @@
 end
 
-%permute indices if coord_y is not the first matrix index
+%permute indices if coord_y is not the first matrix index: vector case
 if test_vector
     VarNameU=Field.ListVarName{VarIndexU};
-    DimCellU=Field.VarDimName{VarIndexU};   
-    eval(['npxy=size(SubField.' VarNameU ')'])
+    DimCellU=Field.VarDimName{VarIndexU} % list of dimensions for u component  
+    eval(['npxy=size(SubField.' VarNameU ')']) % npxy= dimension values for the u component
     SingleCellU={};
     if numel(npxy) < numel(DimCellU)
