Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

netcdf.getConstant

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. To find out more about NetCDF, see netcdf.

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
Was this topic helpful?