Changeset 517 for trunk/src/plot_field.m


Ignore:
Timestamp:
Aug 17, 2012, 11:47:16 PM (9 years ago)
Author:
sommeria
Message:

various bugs corrected. get_field now used in a passive way from uvmat: variable names are transferred from get_field to uvmat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_field.m

    r515 r517  
    540540for icell=1:length(CellVarIndex) % length(CellVarIndex) =1 or 2 (from the calling function)
    541541    VarType=VarTypeCell{icell};
    542     if ~isempty(VarType.coord_tps)
     542    if ~isempty(VarType.coord_tps) %do not plot directly tps data (used for projection only)
    543543        continue
    544544    end
     
    566566            vec_U=Data.(Data.ListVarName{ivar_U});
    567567            vec_V=Data.(Data.ListVarName{ivar_V});
    568             if ~isempty(ivar_X) && ~isempty(ivar_Y)% 2D field (with unstructured coordinates or structured ones (then ivar_X and ivar_Y empty)
     568            if ~isempty(ivar_X) && ~isempty(ivar_Y)% 2D field with unstructured coordinates
    569569                XName=Data.ListVarName{ivar_X};
    570570                YName=Data.ListVarName{ivar_Y};
    571                 eval(['vec_X=reshape(Data.' XName ',[],1);'])
    572                 eval(['vec_Y=reshape(Data.' YName ',[],1);'])
     571                vec_X=reshape(Data.(XName),[],1); %transform vectors in column matlab vectors
     572                vec_Y=reshape(Data.(YName),[],1);
    573573            elseif numel(VarType.coord)==2 && ~isequal(VarType.coord,[0 0]);%coordinates defines by dimension variables
    574                 eval(['y=Data.' Data.ListVarName{VarType.coord(1)} ';'])
    575                 eval(['x=Data.' Data.ListVarName{VarType.coord(2)} ';'])
     574                y=Data.(Data.ListVarName{VarType.coord(1)});
     575                x=Data.(Data.ListVarName{VarType.coord(2)});
    576576                if numel(y)==2 % y defined by first and last values on aregular mesh
    577577                    y=linspace(y(1),y(2),size(vec_U,1));
     
    585585                return
    586586            end
    587             if ~isempty(ivar_C)
    588                  eval(['vec_C=Data.' Data.ListVarName{ivar_C} ';']) ;
    589                  vec_C=reshape(vec_C,1,numel(vec_C));
     587            if isfield(PlotParam.Vectors,'ColorScalar') && ~isempty(PlotParam.Vectors.ColorScalar)
     588                [VarVal,ListVarName,VarAttribute,errormsg]=calc_field_interp([],Data,PlotParam.Vectors.ColorScalar);
     589%             if ~isempty(ivar_C)
     590                 %vec_C=Data.(Data.ListVarName{ivar_C});
     591                 if ~isempty(VarVal)
     592                 vec_C=reshape(VarVal{1},1,numel(VarVal{1}));
    590593                 test_C=1;
     594                 end
    591595            end
    592596            if ~isempty(ivar_F)%~(isfield(PlotParam.Vectors,'HideWarning')&& isequal(PlotParam.Vectors.HideWarning,1))
Note: See TracChangeset for help on using the changeset viewer.