Changeset 46 for trunk/src/struct2nc_toolbox.m
- Timestamp:
- Mar 15, 2010, 5:42:11 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/struct2nc_toolbox.m
r19 r46 89 89 siz=size(VarVal); 90 90 VarDimIndex=Data.VarDimIndex{ivar}; %indices of the variable dimensions in the list of dimensions 91 VarDimName=Data.VarDimName{ivar}; %NEW92 if ischar(VarDimName) %NEW93 VarDimName={VarDimName}; %NEW94 end %NEW95 testrange=(numel(VarDimName)==1 && strcmp(VarDimName{1},ListVarName{ivar}) && numel(VarVal)==2); %NEW91 VarDimName=Data.VarDimName{ivar}; 92 if ischar(VarDimName) 93 VarDimName={VarDimName}; 94 end 95 testrange=(numel(VarDimName)==1 && strcmp(VarDimName{1},ListVarName{ivar}) && numel(VarVal)==2); 96 96 testline=isequal(length(siz),2) & isequal(siz(1),1)& isequal(siz(2), Data.DimValue(VarDimIndex)); 97 97 testcolumn=isequal(length(siz),2) & isequal(siz(1), Data.DimValue(VarDimIndex))& isequal(siz(2),1); … … 100 100 break 101 101 end 102 if testline || testrange %NEW102 if testline || testrange 103 103 dimname=Data.ListDimName{VarDimIndex}; 104 if testrange %NEW105 VarVal=linspace(VarVal(1),VarVal(2),Data.DimValue(VarDimIndex)); %NEW106 end %NEW104 if testrange 105 VarVal=linspace(VarVal(1),VarVal(2),Data.DimValue(VarDimIndex)); 106 end 107 107 nc{ListVarName{ivar}}=ncfloat(dimname);%vector of x coordinates 108 108 nc{ListVarName{ivar}}(:) = VarVal'; … … 113 113 %write variable attributes 114 114 if testattr 115 for ivar =1:length(VarAttribute)116 if isstruct(VarAttribute{ivar })117 attr_names=fields(VarAttribute{ivar });115 for ivarattr=1:length(VarAttribute) 116 if isstruct(VarAttribute{ivarattr}) 117 attr_names=fields(VarAttribute{ivarattr}); 118 118 for iattr=1:length(attr_names) 119 119 eval(['attr_val=VarAttribute{ivar}.' attr_names{iattr} ';']);
Note: See TracChangeset
for help on using the changeset viewer.