Create NetCDF variable
varid = netcdf.defVar(ncid,varname,xtype,dimids)
varid = netcdf.defVar(ncid,varname,xtype,dimids)
creates
a new variable in the dataset identified by ncid
.
varname
is a character vector or string scalar that specifies the name of
the variable.
xtype
specifies the NetCDF data type of the
variable, using one of these values.
Value of xtype | MATLAB® Class |
---|---|
'NC_BYTE' | int8 or uint8 [a] |
'NC_CHAR' | char |
'NC_SHORT' | int16 |
'NC_INT' | int32 |
'NC_FLOAT' | single |
'NC_DOUBLE' | double |
[a] NetCDF interprets byte data as either signed or unsigned. |
Alternatively, xtype
can
be the numeric equivalent returned by the netcdf.getConstant
function.
dimids
specifies a list of dimension IDs.
netcdf.defVar
returns varid
,
a numeric identifier for the new variable.
This function corresponds to the nc_def_var
function in the NetCDF library
C API. Because MATLAB uses FORTRAN-style ordering, the fastest-varying
dimension comes first and the slowest comes last. Any unlimited
dimension is therefore last in the list of dimension IDs. This
ordering is the reverse of that found in the C API.To use this
function, you should be familiar with the NetCDF programming
paradigm.