netcdf.getConstant - Return numeric value of named constant - MATLAB (original) (raw)
Main Content
Return numeric value of named constant
Syntax
val = netcdf.getConstant(param_name)
Description
val = netcdf.getConstant(param_name)
returns the numeric value corresponding to the name of a constant defined by the netCDF library. For example, netcdf.getConstant('NC_NOCLOBBER')
returns the numeric value corresponding to the netCDF constant NC_NOCLOBBER
.
The value for param_name
can be either upper- or lowercase, and does not need to include the leading three characters 'NC_'
. To retrieve a list of all the names defined by the netCDF library, use the netcdf.getConstantNames
function.
This function has no direct equivalent in the netCDF C interface.
Examples
This example opens the example netCDF file included with MATLABĀ®, example.nc
.
% Open example file. ncid = netcdf.open('example.nc','NC_NOWRITE');
% Determine contents of the file. [ndims nvars natts dimm] = netcdf.inq(ncid);
% Get name of global attribute. % Note: You must use netcdf.getConstant to specify NC_GLOBAL. attname = netcdf.inqattname(ncid,netcdf.getConstant('NC_GLOBAL'),0)
attname =
creation_date