Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 57)
+++ trunk/src/uvmat.m	(revision 59)
@@ -316,5 +316,5 @@
     elseif ischar(input)% file name introduced as input
            inputfile=input;
-    elseif isnumeric(input)
+    elseif isnumeric(input)%simple matrix introduced as input
         sizinput=size(input);
         if sizinput(1)<=1 || sizinput(2)<=1
@@ -322,7 +322,9 @@
             return
         end
+        Field.ListVarName={'A','coord_y','coord_x'};
+        Field.VarDimName={{'coord_y','coord_x'},'cord_y','coord_x'};
         Field.A=input;
-        Field.AX=[0.5 size(input,2)-0.5];
-        Field.AY=[size(input,1)-0.5 0.5];
+        Field.coord_x=[0.5 size(input,2)-0.5];
+        Field.coord_y=[size(input,1)-0.5 0.5];
     end
     if ~isempty(inputfile)
@@ -335,5 +337,5 @@
         set(handles.Fields,'Value',1)
         set(handles.Fields,'String',{'get_field...'})    
-        set(handles.Fields,'UserData',Field)
+       % set(handles.Fields,'UserData',Field)
         testinputfield=1;
         
@@ -364,5 +366,5 @@
     end  
     if isempty(inputfile)
-        run0_Callback(hObject, eventdata, handles)
+        errormsg=refresh_field(handles,[],[],[],[],[],[],{Field});
         set(handles.MenuTools,'Enable','on')
         set(handles.OBJECT_txt,'Visible','on')
@@ -636,6 +638,6 @@
 drawnow
 set(handles.Fields,'UserData',[])% reinialize data from uvmat opening
-huvmat=get(handles.RootPath,'parent');
-UvData=get(huvmat,'UserData');%huvmat=handles of the uvmat interface
+%huvmat=get(handles.RootPath,'parent');
+UvData=get(handles.uvmat,'UserData');%huvmat=handles of the uvmat interface
 UvData.NewSeries=1; %flag for run0: begin a new series
 UvData.TestInputFile=1;
@@ -662,5 +664,5 @@
     nburst=1;
     set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
-    XmlData.Time=[0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond]';
+    XmlData.Time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)';
     TimeUnit='s';
     set(handles.npx,'String',num2str(info.Width));%fills nbre of pixels x box
@@ -810,5 +812,5 @@
 UvData.XmlData=XmlData;
 UvData.NewSeries=1;
-set(huvmat,'UserData',UvData)
+set(handles.uvmat,'UserData',UvData)
 
 %display warning message
@@ -824,5 +826,5 @@
    Data=nc2struct(FileName,'ListGlobalAttribute','absolut_time_T0','civ');
    col_vec=get(handles.col_vec,'String');
-   if isfield(Data,'absolut_time_T0')&& ~(isfield(Data,'civ') && isequal(Data.civ,0))
+   if ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)
        set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'})
        set(handles.Fields,'Value',3) % set menu to 'velocity'
@@ -899,4 +901,5 @@
     mask_test_Callback(hObject, eventdata, handles)
 end
+
 %-------------------------------------------------------------------
 function MenuBrowse_1_Callback(hObject, eventdata, handles)
@@ -1613,5 +1616,5 @@
 movie_status=get(handles.movie_pair,'Value');
 if isequal(movie_status,1)
-    STOP_Callback(hObject, eventdata, handles)
+    STOP_Callback(hObject, eventdata, handles)%interrupt movie pair if active
 end
 %read the data on the current input rootfile(s)
@@ -1626,66 +1629,80 @@
 
 sub_value= get(handles.SubField,'Value');
-if sub_value ==1
+if sub_value % a second input file has been entered
     [FileName_1,RootPath_1,filebase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
+    [pp,ff,str1,str2,str_a,str_b]=name2display(FileIndices_1);
+    num1_1=stra2num(str1);%current set of indices for the second field (may be set different than the main indices)
+    num2_1=stra2num(str2);
+    num_a_1=stra2num(str_a);
+    num_b_1=stra2num(str_b);
+    NomType_1=get(handles.FileIndex_1,'UserData');
+else
+    filename_1=[];
 end   
 
 comp_input=get(handles.fix_pair,'Value');
-if isequal(NomType,'_i1-i2')|isequal(NomType,'_i1-i2_j')
-    comp_input=1; %impose a fixed pair interval
+if isequal(NomType,'_i1-i2')||isequal(NomType,'_i1-i2_j')
+    comp_input=1; %impose a fixed pair 
     set(handles.fix_pair,'Value',1)
 end
 
 %case of scanning along the first direction (rootfile numbers)
-if get(handles.scan_i,'Value')==1% case of scanning along field numbers   
+if get(handles.scan_i,'Value')==1% case of scanning along index i   
      num1=num1+increment;
      num2=num2+increment;
-    if comp_input==0% find a free pair
-        [filename,num_i1_out,num_j1_out,num_i2_out,num_j2_out]=...
-           name_generator(filebase,num1,num_a,FileExt,NomType,0,num2,num_b,subdir);
-        if exist(filename,'file')
-            num_a=num_j1_out;
-            num_b=num_j2_out;
-        end 
-    end
-    if sub_value>=2
-        num_i1=num_i1+increment;
-        num_i2=num_i2+increment;
-    end   
-else % case of scanning along the second direction (burst numbers)
-    lastfield_cell=get(handles.last_j,'String'); % get the last field number
-    lastfield=str2num(lastfield_cell{1});
+     [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);
+     if sub_value% set the second field name and indices
+        num1_1=num1_1+increment;
+        num2_1=num2_1+increment;
+        filename_1=name_generator(filebase_1,num1_1,num_a_1,FileExt_1,NomType_1,1,num2_1,num_b_1,SubDir_1);
+     end   
+else % case of scanning along index j (burst numbers)
     num_a=num_a+increment;
     num_b=num_b+increment;
-    if sub_value >=2
-      num_j1=num_j1+increment;
-      num_j2=num_j2+increment;
-    elseif ~isempty(lastfield) && num_a>lastfield
-        num_a=1;
-        num1=num1+1;
-        num2=num2+1;
-    end
-end
-
-% display the new open numbers
-set(handles.i1,'String',num2stra(num1,NomType,1)); 
-set(handles.i2,'String',num2stra(num2,NomType,1));
-set(handles.j1,'String',num2stra(num_a,NomType,2));
-set(handles.j2,'String',num2stra(num_b,NomType,2));
-[indices]=name_generator('',num1,num_a,'',NomType,1,num2,num_b,'');
-set(handles.FileIndex,'String',indices);
-if sub_value ==1
-    NomType_1=get(handles.FileIndex_1,'UserData');
-     [indices]=...
-           name_generator('',num1,num_a,'',NomType_1,1,num2,num_b,'');
-     set(handles.FileIndex_1,'String',indices);
-end
-
-if isequal(movie_status,1)
-    set(handles.movie_pair,'Value',1)
-    movie_pair_Callback(hObject, eventdata, handles); %run
-else
+    if sub_value 
+        num_a_1=num_a_1+increment;
+        num_b_1=num_b_1+increment;
+        filename_1=name_generator(filebase_1,num1_1,num_a_1,FileExt_1,NomType_1,1,num2_1,num_b_1,SubDir_1);
+%     else % redefine the j index if it exceeds its upper bound (only in the absence of a second field)
+%         lastfield_cell=get(handles.last_j,'String'); % get the last field number
+%         lastfield=str2double(lastfield_cell{1});
+%         if num_a>lastfield && ~isnan(lastfield) 
+%             num_a=mod(num_a,lastfield);
+%             num_b=mod(num_b,lastfield)
+%         end
+    end
+    filename=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);
+end
+
 % refresh plots
-    run0_Callback(hObject, eventdata, handles); %run
-end
+errormsg=refresh_field(handles,filename,filename_1,num1,num2,num_a,num_b);
+
+if isempty(errormsg)  %update the index counters
+    set(handles.i1,'String',num2stra(num1,NomType,1)); 
+    if isequal(num2,num1)
+         set(handles.i2,'String','');
+    else
+        set(handles.i2,'String',num2stra(num2,NomType,1));
+    end 
+    set(handles.j1,'String',num2stra(num_a,NomType,2));
+    if isequal(num_b,num_a)
+         set(handles.j2,'String','');
+    else
+        set(handles.j2,'String',num2stra(num_b,NomType,2));
+    end
+    [indices]=name_generator('',num1,num_a,'',NomType,1,num2,num_b,'');
+    set(handles.FileIndex,'String',indices);
+    if sub_value 
+         indices_1=name_generator('',num1_1,num_a_1,'',NomType_1,1,num2_1,num_b_1,'');
+         set(handles.FileIndex_1,'String',indices_1);
+    end
+    if isequal(movie_status,1)
+        set(handles.movie_pair,'Value',1)
+        movie_pair_Callback(hObject, eventdata, handles); %reactivate moviepair if it was activated
+    end
+else
+     msgbox_uvmat('ERROR',errormsg);
+end
+
 
 
@@ -1696,5 +1713,7 @@
 status=get(handles.movie_pair,'value');
 if isequal(status,0)
-    set(handles.movie_pair,'BusyAction','Cancel')
+    set(handles.movie_pair,'BusyAction','Cancel')%stop movie pair if button is 'off'
+    set(handles.i2,'String','')
+    set(handles.j2,'String','')
     return
 else
@@ -1708,5 +1727,5 @@
 FieldName=list_fields{index_fields}; % selected field
 if isequal(FieldName,'image')
-    run0_Callback(hObject, eventdata, handles)%display the first image
+%     run0_Callback(hObject, eventdata, handles)%display the first image
     UvData=get(handles.uvmat,'UserData');
 else
@@ -1806,21 +1825,49 @@
 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
 
-%-------------------------------------------------------
+%------------------------------------------------------------------------
 % --- Executes on button press in run0.
-%-------------------------------------------------
 function run0_Callback(hObject, eventdata, handles)
-
+%------------------------------------------------------------------------
+filename=read_file_boxes(handles);
+
+filename_1=[];%default
+if get(handles.SubField,'Value')
+    filename_1=read_file_boxes_1(handles);
+end
+num_i1=stra2num(get(handles.i1,'String'));
+num_i2=stra2num(get(handles.i2,'String'));
+num_j1=stra2num(get(handles.j1,'String'));
+num_j2=stra2num(get(handles.j2,'String'));
+errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2);
+if ~isempty(errormsg)
+      msgbox_uvmat('ERROR',errormsg);
+end    
+
+%------------------------------------------------------------------------
+% --- read the input files and refresh all the plots, including projection.
+% OUTPUT: 
+%  errormsg: error message char string  =[] by default
+% INPUT:
+% filename: first input file (=[] in the absence of input file)
+% filename_1: second input file (=[] in the asbsenc of secodn input file) 
+% num_i1,num_i2,num_j1,num_j2; frame indices
+% Field: structure describing an optional input field (then replace the input file)
+
+function errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,Field)
+%------------------------------------------------------------------------
 %initialisation
 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
 drawnow
+errormsg=[]; % default error message
 abstime=[];
 abstime_1=[];
 dt=[];
-Field={};
+if ~exist('Field','var')
+    Field={};
+end
 UvData=get(handles.uvmat,'UserData');
-if isfield(UvData,'Txt')
-    UvData=rmfield(UvData,'Txt');%erase previous error message
-end
-%set(handles.run0,'BusyAction','queue');
+% if isfield(UvData,'Txt')
+%     UvData=rmfield(UvData,'Txt');%erase previous error message
+% end
 if ishandle(handles.UVMAT_title) %remove title panel on uvmat
     delete(handles.UVMAT_title)
@@ -1828,20 +1875,12 @@
 
 % determine the main input file information for action
-TestInputFile=1;%default
-if isfield(UvData,'TestInputFile')&& isequal(UvData.TestInputFile,0),
-    TestInputFile=0;
-end
-num_i1=[];%default
 FileType=[];%default
-if TestInputFile
-    [filename,RootPath,filebase,xx,Ext]=read_file_boxes(handles);
+if ~isempty(filename)
+%     [filename,RootPath,filebase,xx,Ext]=read_file_boxes(handles);
     if ~exist(filename,'file')
-        msgbox_uvmat('ERROR',['input file ' filename ' does not exist'])
+        errormsg=['input file ' filename ' does not exist'];
         return
     end
-    num_i1=stra2num(get(handles.i1,'String'));
-    num_i2=stra2num(get(handles.i2,'String'));
-    num_j1=stra2num(get(handles.j1,'String'));
-    num_j2=stra2num(get(handles.j2,'String'));
+    Ext=get(handles.FileExt,'String');
     NomType=get(handles.FileIndex,'UserData');
     %update the z position index
@@ -1880,5 +1919,4 @@
     end
 else
-    filename=[];
     FileType='netcdf';
     FieldName='get_field...';
@@ -1889,8 +1927,5 @@
     index_fields=get(handles.Fields,'Value');% selected string index
     FieldName= list_fields{index_fields}; % selected field
-    if isequal(FieldName,'get_field...')% read the field names on the interface get_field...
-        VelType=get(handles.Fields,'UserData'); 
-        Field{1}=get(handles.Fields,'UserData');
-    else
+    if ~isequal(FieldName,'get_field...')% read the field names on the interface get_field...
        VelType=setfield(handles);
     end
@@ -1898,5 +1933,4 @@
 
 % choose a second field if Subfield option is 'on'
-filename_1=[];
 FieldName_1=[];
 scal_color=[];
@@ -1904,10 +1938,7 @@
 sub_value=get(handles.SubField,'Value');
 FileType_1='none';%default
-if sub_value==1
-    filename_1=read_file_boxes_1(handles);
-    if ~exist(filename_1,'file')
-        msgbox_uvmat('ERROR',['second file ' filename_1 ' does not exist'])
-        return
-    end
+%if sub_value==1
+if ~isempty(filename_1)
+    % test for a constant second field (comparison with a fixed field)
     NomType_1=get(handles.FileIndex_1,'UserData');
     Ext_1=get(handles.FileExt_1,'String');
@@ -1949,21 +1980,20 @@
         end
     end
-end
-
-% test for keeping the previous stored data if the input files are unchanged
-test_keepdata_1=0;%defautl
-test_keepdata=0;
-if sub_value>=2
-    if ~isequal(NomType_1,'*')%in cas of a series of files (not avi movie)
+    test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged
+    if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie)
         if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1')
             test_keepdata_1= isequal(filename_1,UvData.filename_1)&&...
                 isequal(VelType_1,UvData.filename_1) && isequal(FieldName_1,UvData.FieldName_1);
-
         end
     end
+    if test_keepdata_1
+        Field{2}=UvData.Field_1;   
+    elseif ~exist(filename_1,'file')
+        errormsg=['second file ' filename_1 ' does not exist'];
+        return
+    end
 end
 
 %read the input field(s)
-
 %read images
 if ~isempty(filename) && isequal(FieldName,'image')
@@ -2001,5 +2031,5 @@
 
 %read a second image
-if ~isfield(UvData,'Txt')&& ~isempty(filename_1) && isequal(FieldName_1,'image')
+if  ~isempty(filename_1) && ~test_keepdata_1 && isequal(FieldName_1,'image')
     switch FileType_1
         case 'movie'
@@ -2039,5 +2069,5 @@
 InputField={FieldName};
 InputField_1={FieldName_1};
-if ~isfield(UvData,'Txt') && ((~isempty(filename)&& isequal(FileType,'netcdf')) || (~isempty(filename_1)&& isequal(FileType,'netcdf'))) ;
+if (~isempty(filename)&& isequal(FileType,'netcdf')) || (~isempty(filename_1)&& isequal(FileType_1,'netcdf')) ;
     %read the velocity field(s) from netcdf rootfile(s)
     list_code=get(handles.col_vec,'String');% list menu fields
@@ -2052,5 +2082,5 @@
     if isequal(FileType,'netcdf')  %read the first nc field
         if isequal(FieldName,'get_field...')% read the field names on the interface get_field.
-            VelType=get(handles.Fields,'UserData');
+            %VelType=get(handles.Fields,'UserData');
             hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI
             if isempty(hget_field)
@@ -2063,5 +2093,5 @@
             [Field{1},errormsg]=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
             if ~isempty(errormsg)
-                msgbox_uvmat('ERROR',['error in uvmat/run0_Callback/read_get_field: ' errormsg])
+                errormsg=['error in uvmat/run0_Callback/read_get_field: ' errormsg];
                 return
             end
@@ -2071,5 +2101,5 @@
             [Field{1},VelType_out]=read_civxdata(filename,InputField,VelType);
             if isfield(Field{1},'Txt')
-                msgbox_uvmat('ERROR',Field{1}.Txt)
+                errormsg=Field{1}.Txt;
                 return
             end
@@ -2078,5 +2108,5 @@
         end
     end
-    if ~isempty(filename_1) && isequal(FileType_1,'netcdf') %read the second file
+    if ~isempty(filename_1) && ~test_keepdata_1 && isequal(FileType_1,'netcdf') %read the second file
         if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field.
             hget_field=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI
@@ -2123,9 +2153,14 @@
 end
 
+%store the second field for possible latter use
+if numel(Field)==2
+    UvData.Field_1=Field{2};
+end
+
 %update the display buttons for the first velocity type (first menuline)
 veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
 if ~isequal(FileType,'netcdf')
     reset_vel_type(veltype_handles)
-elseif isempty(VelType)
+elseif isempty(VelType) && ~isequal(FieldName,'get_field...')
     set_veltype_display(veltype_handles,CivStage)%update the display of available velocity types for the first field
     if isempty(VelType_out)
@@ -2141,5 +2176,5 @@
 if ~isequal(FileType_1,'netcdf')
     reset_vel_type(veltype_handles_1)
-elseif isempty(VelType_1)
+elseif isempty(VelType_1) && ~isequal(FieldName_1,'get_field...')
     set_veltype_display(veltype_handles_1,CivStage_1)%update the display of available velocity types for the first field
     if isempty(VelType_out_1)
@@ -2180,7 +2215,6 @@
 
 %multislice case
-if TestInputFile &&(~isfield(UvData,'NbDim') || isequal(UvData.NbDim,2))&&...%2D case
+if ~isempty(filename) &&(~isfield(UvData,'NbDim') || isequal(UvData.NbDim,2))&&...%2D case
       isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')&& isfield(UvData.XmlData.GeometryCalib,'SliceCoord')
-%     nbfield2=str2num(get(handles.last_j,'String'));
        siz=size(UvData.XmlData.GeometryCalib.SliceCoord);
        if siz(1)>1
@@ -2192,8 +2226,5 @@
        end
        set(handles.nb_slice,'String',num2str(NbSlice))
-       slices_Callback(hObject, eventdata, handles)
-%        Coord=UvData.XmlData.GeometryCalib.SliceCoord;
-%        ZIndex=num_i1-NbSlice*(floor((num_i1-1)/NbSlice));
-%        Field{1}.Z=ZIndex;
+       slices_Callback(handles.uvmat, [], handles)
 end
 
@@ -2220,14 +2251,14 @@
 menu_transform=get(handles.transform_fct,'String');
 choice_value=get(handles.transform_fct,'Value');
-%transform=menu_transform{choice_value};%name of the transform fct  given by the menu 'transform_fct'
 transform_list=get(handles.transform_fct,'UserData');
 transform=transform_list{choice_value};%selected function handles
 
 % z index
-if TestInputFile
+if ~isempty(filename)
     Field{1}.ZIndex=mod(num_i1-1,nbslice)+1;
 end
+
 %px to phys or other transform on field
-if  ~isempty(transform) 
+if ~isempty(transform) 
     if length(Field)>=2
         Field{2}.ZIndex=mod(num_i1-1,nbslice)+1;
@@ -2245,5 +2276,5 @@
     Field{1}=calc_field(InputField,Field{1});
 end
-if length(Field)==2 && isequal(FileType_1,'netcdf') && ~isequal(FieldName_1,'get_field...')
+if length(Field)==2 && ~test_keepdata_1 && isequal(FileType_1,'netcdf') && ~isequal(FieldName_1,'get_field...')
     Field{2}=calc_field(InputField_1,Field{2});
 end
@@ -2251,10 +2282,9 @@
 % combine the two input fields (e.g. substract velocity fields)
 if numel(Field)==2
-    if ~(isequal(get(handles.movie_pair,'Value'),1) && isequal(FieldName,'image') && isequal(FieldName_1,'image')) %combine fields if not viewing image pairs
-        UvData.Field=sub_field(Field{1},Field{2}); %TO UPDATE FOR MORE GENERAL INPUT
-    end
+   UvData.Field=sub_field(Field{1},Field{2}); %TO UPDATE FOR MORE GENERAL INPUT  
 else
    UvData.Field=Field{1};
 end
+
 UvData.NewSeries=0;% put to 0 the test for a new field series (set by RootPath_callback)
 % test 3D , default projection menuplane and typical mesh (needed to menuopen set_object)
@@ -2266,5 +2296,5 @@
 [UvData.Field,errormsg]=check_field_structure(UvData.Field);
 if ~isempty(errormsg)
-    msgbox_uvmat('ERROR',['error in uvmat/run0_Callback/check_field_structure: ' errormsg])
+    errormsg=['error in uvmat/run0_Callback/check_field_structure: ' errormsg];
     return
 end
@@ -2511,10 +2541,10 @@
                     get_field([],ObjectData)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field)
                 else
-                    msgbox_uvmat('ERROR','The field defined by get_field cannot be plotted')
+                    errormsg='The field defined by get_field cannot be plotted';
+                    return
                 end 
             end  
             UvData.Object{iobj}.PlotParam=ScalOut; %record the plotting parameters
-        end
-        
+        end       
     end
 end
@@ -2559,5 +2589,5 @@
     set(handles.histo1_menu,'Value',1)
     set(handles.histo1_menu,'String',menu_histo)
-    histo1_menu_Callback(hObject, eventdata, handles)
+    histo1_menu_Callback(handles.histo1_menu, [], handles)
     if nb_histo > 1
         test_v=1;
@@ -2566,5 +2596,5 @@
         set(handles.histo2_menu,'String',menu_histo)
         set(handles.histo2_menu,'Value',2)
-        histo2_menu_Callback(hObject, eventdata, handles)
+        histo2_menu_Callback(handles.histo2_menu,[], handles)
     end
 end
@@ -2902,5 +2932,5 @@
 function Fields_Callback(hObject, eventdata, handles)
 %-------------------------------------------------
-huvmat=get(handles.Fields,'parent');
+
 list_fields=get(handles.Fields,'String');% list menu fields
 index_fields=get(handles.Fields,'Value');% selected string index
@@ -2920,5 +2950,5 @@
 index_fields=get(handles.Fields_1,'Value');% selected string index
 field_1= list_fields{index_fields(1)}; % selected string
-UvData=get(huvmat,'UserData');
+UvData=get(handles.uvmat,'UserData');
 
 %read the rootfile input display
@@ -2986,14 +3016,4 @@
     set(handles.fix_pair,'Value',1)
 end
-% if isequal(field,'velocity')|isequal(field_1,'velocity');
-%     state_vect='on';
-% else
-%     state_vect='off';
-% end 
-% if ~isequal(field,'velocity')|(~isequal(field_1,'velocity'));
-%     state_scal='on';
-% else
-%     state_scal='off';
-% end 
 setfield(handles);% update the field structure ('civ1'....)
 
@@ -3006,5 +3026,4 @@
 function Fields_1_Callback(hObject, eventdata, handles)
 %-------------------------------------------------
-huvmat=get(handles.Fields_1,'parent');
 list_fields=get(handles.Fields,'String');% list menu fields
 index_fields=get(handles.Fields,'Value');% selected string index
@@ -3018,5 +3037,5 @@
     return
 end
-UvData=get(huvmat,'UserData');
+UvData=get(handles.uvmat,'UserData');
 
 %read the rootfile input display
@@ -3178,5 +3197,5 @@
     state_scal='off';
 end 
-set(huvmat,'UserData',UvData)
+set(handles.uvmat,'UserData',UvData)
 setfield(handles);% update the field structure ('civ1'....)
 if ~isfield(UvData,'NewSeries')|isequal(UvData.NewSeries,0)
