Changeset 55 for trunk/src/struct2nc.m
- Timestamp:
- Mar 17, 2010, 10:26:41 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/struct2nc.m
r45 r55 10 10 % Data: structure containing all the information of the netcdf file (or netcdf object) 11 11 % with fields: 12 % .ListGlobalAttribute: cell listing the names of the global attributes (note that a global atribute with the same name as a variable is excluded) 13 % .Att_1,Att_2... : values of the global attributes 14 % .ListDimName: cell listing the names of the array dimensions 15 % .DimValue: array dimension values (Matlab vector with the same length as .ListDimName 16 % .ListVarName: cell listing the names of the variables 17 % .VarDimIndex: cell containing the set of dimension indices (in list .ListDimName) for each variable of .ListVarName 18 % .VarAttribute: cell of structures s containing names and values of variable attributes (s.name=value) for each variable of .ListVarName 19 % .Var1, .Var2....: variables (Matlab arrays) with names listed in .ListVarName 12 % (optional) .ListGlobalAttribute: cell listing the names of the global attributes 13 % .Att_1,Att_2... : values of the global attributes 14 % (requested) .ListVarName: list of variable names to select (cell array of char strings {'VarName1', 'VarName2',...} ) 15 % (requested) .VarDimName: list of dimension names for each element of .ListVarName (cell array of string cells) 16 % (requested) .Var1, .Var2....: variables (Matlab arrays) with names listed in .ListVarName 20 17 % 21 18 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA … … 126 123 break 127 124 end 128 if testline || testrange %NEW125 if testline || testrange 129 126 if testrange 130 VarVal=linspace(VarVal(1),VarVal(2),Data.DimValue(VarDimIndex)); %NEW127 VarVal=linspace(VarVal(1),VarVal(2),Data.DimValue(VarDimIndex)); 131 128 end 132 129 %nc{ListVarName{ivar}}=ncfloat(Data.ListDimName(VarDimIndex));%vector of x coordinates 133 netcdf.putVar(nc,varid(ivar), VarVal');130 netcdf.putVar(nc,varid(ivar), double(VarVal')); 134 131 else 135 netcdf.putVar(nc,varid(ivar), VarVal);132 netcdf.putVar(nc,varid(ivar), double(VarVal)); 136 133 %nc{ListVarName{ivar}}(:) = VarVal; 137 134 end
Note: See TracChangeset
for help on using the changeset viewer.