Changeset 1095 for trunk/src/get_field.m


Ignore:
Timestamp:
Mar 31, 2021, 3:32:03 PM (3 years ago)
Author:
sommeria
Message:

reading mat files added, +-fixed,OpenDAP improved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/get_field.m

    r1093 r1095  
    7979if ischar(filename) % input file name
    8080    set(handles.inputfile,'String',filename)% fill the input file name
     81    if ~isempty(regexp(filename,'.mat$'))%case of .mat file
     82        Field=mat2struct(filename);
     83        errormsg='';
     84    else
    8185    [Field,tild,tild,errormsg]=nc2struct(filename,[]);% reads the  field structure, without the variables
     86    end
    8287else
    8388    msgbox_uvmat('ERROR','get_field requires a file name as input')% display error message for input file reading
     
    405410    case '1D plot'
    406411        set(handles.Coordinates,'Visible','on')
    407         %set(handles.PanelOrdinate,'Visible','on')
    408         %pos=get(handles.PanelOrdinate,'Position');
    409 %         pos(1)=2;
    410 %         pos_coord=get(handles.Coordinates,'Position');
    411 %         pos(2)=pos_coord(2)-pos(4)-2;
    412         %set(handles.PanelOrdinate,'Position',pos)
    413412        set(handles.PanelScalar,'Visible','off')
    414413        set(handles.PanelVectors,'Visible','off')
     
    419418        set(handles.Z_title,'Visible','off')
    420419        set(handles.Coord_x,'String',Field.Display.ListVarName')
    421         Coord_x_Callback(hObject, VarName, handles)
    422         %set(handles.Coord_y,'String',Field.Display.ListVarName')
    423         %Coord_x_Callback(hObject, VarName, handles)       
     420        Coord_x_Callback(hObject, VarName, handles)     
    424421    case {'scalar'}
    425422        set(handles.Coordinates,'Visible','on')
    426         %set(handles.PanelOrdinate,'Visible','off')
    427423        set(handles.PanelScalar,'Visible','on')
    428424        set(handles.PanelVectors,'Visible','off')
     
    469465        set(handles.Coord_y,'Visible','on')
    470466        set(handles.Y_title,'Visible','on')
     467        set(handles.Coord_x,'Visible','on')
    471468        %default vector selection
    472469        vector_x_value=get(handles.vector_x,'UserData');
     
    770767update_field(handles,VarName)
    771768end
     769
    772770%------------------------------------------------------------------------
    773771% --- Executes on selection change in vector_x or vector_y
     
    803801    var_coord=find(test_coord);% % list of variable indices elligible as structured coordinates
    804802    var_component(var_component==vector_x_index|var_component==vector_y_index)=[];
    805     var_coord(var_coord==vector_x_index|var_coord==vector_y_index)=[];% remove vector components form te possible list of coordinates
     803    var_coord(var_coord==vector_x_index|var_coord==vector_y_index)=[];% remove vector components from the possible list of coordinates
    806804    ListCoord=Field.Display.ListVarName([var_coord var_component]);
    807805   
     
    844842            coord_val=[1 2 3];
    845843        end
    846         set(handles.Coord_x,'Value',coord_val(end))
    847         set(handles.Coord_y,'Value',coord_val(end-1))
     844        set(handles.Coord_x,'Value',min(coord_val(end),numel(ListCoord)))
     845        set(handles.Coord_y,'Value',min(coord_val(end-1),numel(ListCoord)))
    848846        if numel(coord_val)>=3
    849847            set(handles.Coord_z,'Value',coord_val(end-2))
     
    887885%------------------------------------------------------------------------
    888886function Coord_x_Callback(hObject, DimCell, handles)
    889 DimCell
     887
    890888index=get(handles.Coord_x,'Value');
    891889string=get(handles.Coord_x,'String');
Note: See TracChangeset for help on using the changeset viewer.