Changeset 206 for trunk/src/plot_field.m


Ignore:
Timestamp:
Feb 27, 2011, 10:40:29 PM (13 years ago)
Author:
sommeria
Message:

bug fixes to deal with volumes, storage of ACTION menu in series fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_field.m

    r201 r206  
    159159        return
    160160    end
     161    index_2D=find(NbDim==2,2);%find 2D fields (at most 2)
    161162    index_3D=find(NbDim>2,1);
    162163    if ~isempty(index_3D)
     164        if isfield(Data,'NbDim')&& isequal(Data.NbDim,2)
     165            index_2D=[index_2D index_3D];
     166        else
    163167        msgbox_uvmat('ERROR','volume plot not implemented yet');
    164168        return
    165     end
    166     index_2D=find(NbDim==2,2);%find 2D fields (at most 2)
     169        end
     170    end
     171   
    167172    index_1D=find(NbDim==1);
    168173    index_0D=find(NbDim==0);
     
    243248set(haxes,'UserData',AxeData)
    244249
    245 %% update the parameters stored in parent figure
     250%% update the plotted field stored in parent figure
    246251FigData=get(hfig,'UserData');
    247252tagaxes=get(haxes,'tag');
     
    562567        VarType.coord=VarType.coord(ind_coord);
    563568    end
    564 %     idim_Y=[]; 
    565 %     test_grid=0;
    566569    if ~isempty(ivar_U) && ~isempty(ivar_V)% vector components detected
    567570        if test_vec
     
    725728            siz=3;%color image
    726729        else
    727             errormsg=['unrecognized scalar type: ' num2str(np(3)) ' color components'];
     730            errormsg=['unrecognized scalar type in plot_field: considered as 2D field with ' num2str(np(3)) ' color components'];
    728731            return
    729732        end
     
    748751            PlotParam.Scalar.MaxA=[];%default
    749752        end
     753        Aline=[];
    750754        if isequal(PlotParam.Scalar.FixScal,0)||isempty(PlotParam.Scalar.MinA)||~isa(PlotParam.Scalar.MinA,'double')  %correct if there is no numerical data in edit box
    751             MinA=double(min(min(A)));
     755            Aline=reshape(A,1,[]);
     756            Aline=Aline(~isnan(A));
     757            if isempty(Aline)
     758                 errormsg=['NaN input scalar or image in plot_field'];
     759                return
     760            end
     761            MinA=double(min(Aline))
     762            %MinA=double(min(min(A)));
    752763        else
    753             MinA=PlotParam.Scalar.MinA; 
     764            MinA=PlotParam.Scalar.MinA;
    754765        end;
    755766        if isequal(PlotParam.Scalar.FixScal,0)||isempty(PlotParam.Scalar.MaxA)||~isa(PlotParam.Scalar.MaxA,'double') %correct if there is no numerical data in edit box
    756             MaxA=double(max(max(A)));
     767            if isempty(Aline)
     768               Aline=reshape(A,1,[]);
     769               Aline=Aline(~isnan(A));
     770               if isempty(Aline)
     771                 errormsg=['NaN input scalar or image in plot_field'];
     772                return
     773               end
     774            end
     775            MaxA=double(max(Aline))
     776           % MaxA=double(max(max(A)));
    757777        else
    758778            MaxA=PlotParam.Scalar.MaxA; 
Note: See TracChangeset for help on using the changeset viewer.