netcdf.putAtt
Write NetCDF attribute
Syntax
netcdf.putAtt(ncid,varid,attrname,attrvalue)
netcdf.putAtt(ncid,varid,attrname,attrvalue,xtype)
Description
netcdf.putAtt(ncid,varid,attrname,attrvalue)
writes the attribute named
attrname
with value attrvalue
to the
NetCDF variable specified by varid
. To specify a global attribute,
use netcdf.getConstant('NC_GLOBAL')
for
varid
.
ncid
is a NetCDF file identifier returned by
netcdf.create
or netcdf.open
.
netcdf.putAtt(ncid,varid,attrname,attrvalue,xtype)
writes
attrvalue
as the data type specified in
xtype
. Specify the value of xtype
as:
Character vector or string scalar that contains one of the following values
Value of xtype
MATLAB® Class NC_DOUBLE
double
NC_FLOAT
single
NC_INT64
(NetCDF-4 files only)int64
NC_UINT64
(NetCDF-4 files only)uint64
NC_INT
int32
NC_UINT
(NetCDF-4 files only)uint32
NC_SHORT
int16
NC_USHORT
(NetCDF-4 files only)uint16
NC_BYTE
int8
NC_UBYTE
(NetCDF-4 files only)uint8
NC_CHAR
char
NC_STRING
(NetCDF-4 files only)string
Equivalent numeric value returned by the
netcdf.getConstant
functionNumeric type identifier returned by the
netcdf.defVlen
function (for attributes of the user-definedNC_VLEN
types that correspond to cell arrays)
Note
You cannot use netcdf.putAtt
to set the '_FillValue'
attribute
of NetCDF4 files. Use the netcdf.defVarFill
function
to set the fill value for a variable.
The netcdf.putAtt
function corresponds to several attribute I/O functions
in the NetCDF library C API. To use this function, you should be familiar with the
NetCDF programming paradigm.