| Contents | Index |
attname = netcdf.inqAttName(ncid,varid,attnum)
attname = netcdf.inqAttName(ncid,varid,attnum) returns attname, a text string specifying the name of an attribute.
ncid is a netCDF file identifier returned by netcdf.create or netcdf.open.
varid is a numeric identifier of a variable in the file. If you want to get the name of a global attribute in the file, use netcdf.getConstant('NC_GLOBAL') in place of attnum is a zero-based numeric value specifying the attribute, with 0 indicating the first attribute, 1 the second attribute, and so on.
This function corresponds to the nc_inq_attname function in the netCDF library C API. To use this function, you should be familiar with the netCDF programming paradigm. See netcdf for more information.
This example opens the example netCDF file included with MATLAB, example.nc.
% Open netCDF example file.
ncid = netcdf.open('example.nc','NC_NOWRITE');
% Get identifier of a variable in the file.
varid = netcdf.inqVarID(ncid,'avagadros_number')
% Get the name of the attribute associated with the variable.
attname = netcdf.inqAttName(ncid,varid,0)
attname =
description
% Get the name of the global attribute associated with the variable.
gattname = netcdf.inqAttName(ncid,netcdf.getConstant('NC_GLOBAL'),0)
gattname =
creation_date
netcdf.inqAtt | netcdf.inqAttID
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |