Changeset 548 for trunk/src/sub_field.m


Ignore:
Timestamp:
Oct 10, 2012, 11:25:35 PM (12 years ago)
Author:
sommeria
Message:

various bug repairs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sub_field.m

    r520 r548  
    4545        end
    4646        if ~isfield(Field,AttrName) || ~isequal(Field_1.(AttrName),Field.(AttrName))
    47         SubData.ListGlobalAttribute=[SubData.ListGlobalAttribute {AttrNameNew}];
    48         SubData.(AttrNameNew)=Field_1.(AttrName);
     47            SubData.ListGlobalAttribute=[SubData.ListGlobalAttribute {AttrNameNew}];
     48            SubData.(AttrNameNew)=Field_1.(AttrName);
    4949        end
    5050    end
     
    149149
    150150%% substrat fields when possible
    151 [CellVarIndex,NbDim,CellVarType,errormsg]=find_field_cells(SubData);
     151%[CellVarIndex,NbDim,CellVarType,errormsg]=find_field_cells(SubData);
     152[CellInfo,NbDim,errormsg]=find_field_cells(SubData)
    152153ind_remove=zeros(size(SubData.ListVarName));
    153154ivar=[];
    154155ivar_1=[];
    155 for icell=1:numel(CellVarIndex)
    156     if ~isempty(CellVarIndex{icell})
    157         if isfield(CellVarType{icell},'scalar') && numel(CellVarType{icell}.scalar)==2 && SubData.VarAttribute{CellVarType{icell}.scalar(2)}.CheckSub;
    158             ivar=[ivar CellVarType{icell}.scalar(1)];
    159             ivar_1=[ivar_1 CellVarType{icell}.scalar(2)];
     156for icell=1:numel(CellInfo)
     157    if ~isempty(CellInfo{icell})
     158        if isfield(CellInfo{icell},'VarIndex_scalar') && numel(CellInfo{icell}.VarIndex_scalar)==2 && SubData.VarAttribute{CellInfo{icell}.VarIndex_scalar(2)}.CheckSub;
     159            ivar=[ivar CellInfo{icell}.VarIndex_scalar(1)];
     160            ivar_1=[ivar_1 CellInfo{icell}.VarIndex_scalar(2)];
    160161        end
    161         if isfield(CellVarType{icell},'vector_x') && numel(CellVarType{icell}.vector_x)==2 && SubData.VarAttribute{CellVarType{icell}.vector_x(2)}.CheckSub;
    162             ivar=[ivar CellVarType{icell}.vector_x(1)];
    163             ivar_1=[ivar_1 CellVarType{icell}.vector_x(2)];
     162        if isfield(CellInfo{icell},'VarIndex_vector_x') && numel(CellInfo{icell}.VarIndex_vector_x)==2 && SubData.VarAttribute{CellInfo{icell}.VarIndex_vector_x(2)}.CheckSub;
     163            ivar=[ivar CellInfo{icell}.VarIndex_vector_x(1)];
     164            ivar_1=[ivar_1 CellInfo{icell}.VarIndex_vector_x(2)];
    164165        end
    165         if isfield(CellVarType{icell},'vector_y') && numel(CellVarType{icell}.vector_y)==2 && SubData.VarAttribute{CellVarType{icell}.vector_y(2)}.CheckSub;
    166             ivar=[ivar CellVarType{icell}.vector_y(1)];
    167             ivar_1=[ivar_1 CellVarType{icell}.vector_y(2)];
     166        if isfield(CellInfo{icell},'VarIndex_vector_y') && numel(CellInfo{icell}.VarIndex_vector_y)==2 && SubData.VarAttribute{CellInfo{icell}.VarIndex_vector_y(2)}.CheckSub;
     167            ivar=[ivar CellInfo{icell}.VarIndex_vector_y(1)];
     168            ivar_1=[ivar_1 CellInfo{icell}.VarIndex_vector_y(2)];
    168169        end
    169170    end
     
    172173        VarName=SubData.ListVarName{ivar(imod)};
    173174        VarName_1=SubData.ListVarName{ivar_1(imod)};
    174         SubData.(VarName)=SubData.(VarName)-SubData.(VarName_1);
     175        SubData.(VarName)=double(SubData.(VarName))-double(SubData.(VarName_1));
    175176        ind_remove(ivar_1(imod))=1;
    176177end
Note: See TracChangeset for help on using the changeset viewer.