Changeset 535 for trunk/src/plot_field.m


Ignore:
Timestamp:
Sep 3, 2012, 2:02:13 PM (12 years ago)
Author:
sommeria
Message:

various bugs fixed, in particular patch projection with color images

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_field.m

    r530 r535  
    270270Data={};
    271271for icell=1:length(CellInfo)
    272     VarIndex=CellInfo{icell}.VarIndex;%  indices of the selected variables in the list data.ListVarName
     272   
     273    % select types of  variables to be projected
     274    ListProj={'VarIndex_scalar','VarIndex_image','VarIndex_color','VarIndex_vector_x','VarIndex_vector_y'};
     275    check_proj=false(size(FieldData.ListVarName));
     276    for ilist=1:numel(ListProj)
     277        if isfield(CellInfo{icell},ListProj{ilist})
     278            check_proj(CellInfo{icell}.(ListProj{ilist}))=1;
     279        end
     280    end
     281    VarIndex=find(check_proj);
     282    %
     283    %     VarIndex=CellInfo{icell}.VarIndex;%  indices of the selected variables in the list data.ListVarName
     284    %     for ivar=1:length(VarIndex)
     285    %         checkancillary=0;
     286    %         if length(FieldData.VarAttribute)>=VarIndex(ivar)
     287    %             VarAttribute=FieldData.VarAttribute{VarIndex(ivar)};
     288    %             if isfield(VarAttribute,'Role')&&(strcmp(VarAttribute.Role,'ancillary')||strcmp(VarAttribute.Role,'coord_tps')...
     289    %                     ||strcmp(VarAttribute.Role,'vector_x_tps')||strcmp(VarAttribute.Role,'vector_y_tps'))
     290    %                 checkancillary=1;
     291    %             end
     292    %         end
     293    %         if ~checkancillary% does not display variables with attribute '.Role=ancillary'
    273294    for ivar=1:length(VarIndex)
    274         checkancillary=0;
    275         if length(FieldData.VarAttribute)>=VarIndex(ivar)
    276             VarAttribute=FieldData.VarAttribute{VarIndex(ivar)};
    277             if isfield(VarAttribute,'Role')&&(strcmp(VarAttribute.Role,'ancillary')||strcmp(VarAttribute.Role,'coord_tps')...
    278                     ||strcmp(VarAttribute.Role,'vector_x_tps')||strcmp(VarAttribute.Role,'vector_y_tps'))
    279                 checkancillary=1;
    280             end
    281         end
    282 %         if ~checkancillary% does not display variables with attribute '.Role=ancillary'
    283             VarName=FieldData.ListVarName{VarIndex(ivar)};
    284             VarValue=FieldData.(VarName);
    285             Data =[Data [{VarName}; num2cell(VarValue)]];
    286             if size(VarValue,1)~=1
    287                 VarValue=VarValue';% put the different values on a line
    288             end
    289             if size(VarValue,1)==1
    290             txt=[VarName '=' num2str(VarValue)];
    291             txt_cell=[txt_cell;{txt}];
    292             end
    293 %         end
     295    VarName=FieldData.ListVarName{VarIndex(ivar)};
     296    VarValue=FieldData.(VarName);
     297    if iscolumn(VarValue)
     298        VarValue=VarValue';% put the different values on a line
     299    end
     300    if numel(VarValue)>1 && numel(VarValue)<10
     301        for ind=1:numel(VarValue)
     302            VarNameCell{1,ind}=[VarName '_' num2str(ilist)];
     303        end
     304    else
     305        VarNameCell={VarName};
     306    end
     307    if numel(VarValue)<10
     308        Data =[Data [VarNameCell; num2cell(VarValue)]];
     309    else
     310        Data =[Data [VarNameCell; {['size ' num2str(size(VarValue))]}]];
     311    end
     312    if size(VarValue,1)==1
     313        txt=[VarName '=' num2str(VarValue)];
     314        txt_cell=[txt_cell;{txt}];
     315    end
    294316    end
    295317end
Note: See TracChangeset for help on using the changeset viewer.