Changeset 580 for trunk/src/uvmat.m


Ignore:
Timestamp:
Mar 7, 2013, 1:47:51 PM (8 years ago)
Author:
sommeria
Message:

bugs corrected for combining fields

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r579 r580  
    10251025        set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data
    10261026        set(handles_Fields,'Value',2) % set menu to 'velocity
     1027        if index==1
     1028            set(handles.FieldName_1,'Value',1);
     1029            set(handles.FieldName_1,'String',[{''};{'image'};FieldList;{'get_field...'}]);%standard menu for civx data reproduced for the second field
     1030        end
    10271031        set(handles.ColorScalar,'Value',1)
    10281032        set(handles.ColorScalar,'String',ColorList)
     
    21382142        return
    21392143    end
    2140     Name=FileName_1;
     2144   % Name=FileName_1;
    21412145    switch UvData.FileType{2}
    21422146        case {'civx','civdata','netcdf'};
     
    21882192    test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged
    21892193    if ~isequal(NomType_1,'*')&& isfield(UvData,'FileName_1')
    2190            test_keepdata_1= strcmp(FileName_1,UvData.FileName_1) ;%&& strcmp(FieldName_1,UvData.FieldName_1);
     2194           test_keepdata_1= strcmp(FileName_1,UvData.FileName_1) ;
    21912195    end
    21922196    if test_keepdata_1
     
    21992203        ParamIn_1.GUIName='get_field_1';
    22002204        end 
    2201         [Field{2},ParamOut_1,errormsg] = read_field(Name,UvData.FileType{2},ParamIn_1,frame_index_1);
     2205        [Field{2},ParamOut_1,errormsg] = read_field(FileName_1,UvData.FileType{2},ParamIn_1,frame_index_1);
    22022206        if ~isempty(errormsg)
    22032207            errormsg=['error in reading ' FieldName_1 ' in ' FileName_1 ': ' errormsg];
     
    22562260test_veltype_1=0;
    22572261if isempty(FileName_1)
    2258 %     set(handles.FieldName_1,'Value',1); %update the field menu
    2259 %     if isstruct(ParamOut)
    2260 %     set(handles.FieldName_1,'String',[{''};ParamOut.FieldList]); %update the field menu
    2261 %     end
     2262    %     set(handles.FieldName_1,'Value',1); %update the field menu
     2263    %     if isstruct(ParamOut)
     2264    %     set(handles.FieldName_1,'String',[{''};ParamOut.FieldList]); %update the field menu
     2265    %     end
    22622266elseif ~test_keepdata_1
    22632267    if (~strcmp(UvData.FileType{2},'netcdf')&&~strcmp(UvData.FileType{2},'civdata')&&~strcmp(UvData.FileType{2},'civx'))|| isequal(FieldName_1,'get_field...')
     
    22732277    % update the second field menu: the same quantity
    22742278    if isstruct(ParamOut_1)
    2275     set(handles.FieldName_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu
    2276     % display the FieldName menu from the input file and pick the selected one:
    2277     field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);
    2278     set(handles.FieldName_1,'Value',find(field_index,1)+1) 
    2279     end
    2280    
     2279%        set(handles.FieldName_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu
     2280        % display the FieldName menu from the input file and pick the selected one:
     2281        FieldList=get(handles.FieldName_1,'String');
     2282        field_index=strcmp(ParamOut_1.FieldName,FieldList);
     2283        if ~isempty(field_index)
     2284            set(handles.FieldName_1,'Value',find(field_index,1))
     2285        end
     2286    end
    22812287end
    22822288if test_veltype||test_veltype_1
    2283      set(handles.FixVelType,'Visible','on')
     2289    set(handles.FixVelType,'Visible','on')
    22842290else
    2285      set(handles.FixVelType,'Visible','off')
     2291    set(handles.FixVelType,'Visible','off')
    22862292end
    22872293
     
    29632969    set(handles.VelType_1,'Value',1);%set to blank state
    29642970    set(handles.num_Opacity,'String','')% desactivate opacity setting
     2971    FieldList=get(handles.FieldName,'String');
     2972    if numel(FieldList)>1   % if a choice of fields exists
     2973        set(handles.FieldName_1,'Value',1)% set second field choice to blank
     2974        set(handles.FieldName_1,'String',[{''};FieldList])% reproduce the menu FieldName plus a blank option
     2975    else
     2976        set(handles.FieldName_1,'String',{''})% set second field choice to blank
     2977    end
    29652978    if ~strcmp(get(handles.VelType,'Visible'),'on')
    29662979        set(handles.VelType_1,'Visible','off')
     
    31943207        end
    31953208    otherwise
    3196         if check_new
    3197             UvData.FileType{2}=UvData.FileType{1};
     3209        check_refresh=1;
     3210        if check_new% if a second field was not previously entered, we just read another field in the first input file
    31983211            set(handles.FileIndex_1,'String',get(handles.FileIndex,'String'))
    31993212            set(handles.FileExt_1,'String',get(handles.FileExt,'String'))
     3213           
     3214            UvData.FileType{2}=UvData.FileType{1};
     3215            UvData.XmlData{2}= UvData.XmlData{1};
     3216            transform=get(handles.path_transform,'UserData');
     3217             if (~isa(transform,'function_handle')||nargin(transform)<3)
     3218                set(handles.uvmat,'UserData',UvData)
     3219                set(handles.transform_fct,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields
     3220                transform_fct_Callback(hObject, eventdata, handles)% activate transform_fct_Callback and refresh current plot
     3221                 check_refresh=0;
     3222             end             
    32003223        end
    32013224        if ~isequal(field,'image')
     
    32053228        end
    32063229        set(handles.uvmat,'UserData',UvData)
    3207         if ~(isfield(UvData,'NewSeries')&&isequal(UvData.NewSeries,1))
     3230 
     3231        if check_refresh && ~(isfield(UvData,'NewSeries')&&isequal(UvData.NewSeries,1))
    32083232            run0_Callback(hObject, eventdata, handles)
    32093233        end
     
    32803304        FileName_1='';% we plot the first input field without the second field
    32813305        set(handles.SubField,'Value',0)
    3282         SubField_Callback(hObject, eventdata, handles)% activate SubField_Callback and refresh current display, removing the second field
     3306        SubField_Callback(hObject, eventdata, handles)% activate SubField_Callback and refresh current plot, removing the second field
    32833307elseif get(handles.SubField,'Value')% if subfield is already 'on'
    32843308     FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];% name of the second input file
    3285      check_refresh=1;%will refresh the current display
     3309     check_refresh=1;%will refresh the current plot
    32863310else% we introduce the same file (with a different field) for the second series
    32873311     FileName_1=FileName;% we compare two fields in the same file
     
    32913315     transform=get(handles.path_transform,'UserData');
    32923316     if (~isa(transform,'function_handle')||nargin(transform)<3)
    3293         set(handles.transform_fct,'value',2); % set transform to sub_field if the current fct doe not accept two input fields
    3294         transform_fct_Callback(hObject, eventdata, handles)% activate transform_fct_Callback and refresh current display
     3317        set(handles.uvmat,'UserData',UvData)
     3318        set(handles.transform_fct,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields
     3319        transform_fct_Callback(hObject, eventdata, handles)% activate transform_fct_Callback and refresh current plot
    32953320     else
    32963321         check_refresh=1;
     
    32983323end
    32993324
    3300 % refresh the current display if it has not been done previously
     3325% refresh the current plot if it has not been done previously
    33013326if check_refresh
    33023327    UvData.FileName_1='';% desactivate the use of a constant second file
     
    33213346end
    33223347
    3323 %-----------------------------------------------
     3348
     3349%-----------------------------------------------------------------------
    33243350% --- reset civ buttons
    33253351function reset_vel_type(handles_civ0,handle1)
     3352%-----------------------------------------------------------------------
    33263353for ibutton=1:length(handles_civ0)
    33273354    set(handles_civ0(ibutton),'BackgroundColor',[0.831 0.816 0.784])
     
    33323359end
    33333360
    3334 %-------------------------------------------------------
     3361%-----------------------------------------------------------------------
    33353362% --- Executes on button press in MENUVOLUME.
    3336 %-------------------------------------------------------
    33373363function VOLUME_Callback(hObject, eventdata, handles)
     3364%-----------------------------------------------------------------------
    33383365%errordlg('command VOL not implemented yet')
    33393366if ishandle(handles.UVMAT_title)
Note: See TracChangeset for help on using the changeset viewer.