netcdf.getConstant
名前付きの定数の数値を返します。
構文
val = netcdf.getConstant(param_name)
説明
val = netcdf.getConstant(param_name) は、netCDF ライブラリで定義された定数の名前に対応する数値を返します。たとえば、netcdf.getConstant('NC_NOCLOBBER') は、netCDF の定数 NC_NOCLOBBER に対応する数値を返します。
param_name に対する値は、大文字小文字のいずれにもすることができます。また、先頭の 3 つの文字 'NC_' を含む必要はありません。netCDF ライブラリによって定義されるすべての名前を取り出すには、関数 netcdf.getConstantNames を使用します。
この関数には netCDF C インターフェイスで完全に相当するものはありません。
例
この例では、MATLAB® に含まれている netCDF サンプル ファイル 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