Changeset 580 for trunk/src/sub_field.m
- Timestamp:
- Mar 7, 2013, 1:47:51 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sub_field.m
r548 r580 105 105 end 106 106 107 % look for coordinates common to Field in Field_1107 %% look for coordinates common to Field in Field_1 108 108 ind_remove=zeros(size(Field_1.ListVarName)); 109 109 for ilist=1:numel(Field_1.ListVarName) … … 121 121 NewDim={NewDim}; 122 122 end 123 Field_1.VarDimName=regexprep_r(Field_1.VarDimName, OldDim{1},NewDim{1});123 Field_1.VarDimName=regexprep_r(Field_1.VarDimName,['^' OldDim{1} '$'],NewDim{1}); 124 124 end 125 125 end … … 130 130 Field_1.VarAttribute(find(ind_remove))=[]; 131 131 132 % append the other variables of the second field, modifying their name if needed132 %% append the other variables of the second field, modifying their name if needed 133 133 for ilist=1:numel(Field_1.ListVarName) 134 134 VarName=Field_1.ListVarName{ilist}; … … 138 138 else % variable name exists in Field 139 139 VarNameNew=[VarName '_1']; 140 if isfield(Field_1.VarAttribute{ilist},'FieldName') 141 Field_1.VarAttribute{ilist}.FieldName=regexprep_r(Field_1.VarAttribute{ilist}.FieldName,VarName,VarNameNew); 142 end 140 143 end 141 144 SubData.ListVarName=[SubData.ListVarName {VarNameNew}]; … … 146 149 end 147 150 148 %append the other variables of the second field, modifying their name if needed149 150 151 %% substrat fields when possible 151 152 %[CellVarIndex,NbDim,CellVarType,errormsg]=find_field_cells(SubData); 152 [CellInfo,NbDim,errormsg]=find_field_cells(SubData) 153 [CellInfo,NbDim,errormsg]=find_field_cells(SubData); 153 154 ind_remove=zeros(size(SubData.ListVarName)); 154 155 ivar=[]; … … 179 180 SubData.VarDimName(find(ind_remove))=[]; 180 181 SubData.VarAttribute(find(ind_remove))=[]; 182 %end 181 183 182 function OutputCell=regexprep_r(InputCell, dimname,dimname_new)184 function OutputCell=regexprep_r(InputCell,search_string,new_string) 183 185 for icell=1:numel(InputCell) 184 OutputCell{icell}=regexprep(InputCell{icell}, ['^' dimname '$'],dimname_new);186 OutputCell{icell}=regexprep(InputCell{icell},search_string,new_string); 185 187 end 186 188
Note: See TracChangeset
for help on using the changeset viewer.