| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
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 information about netCDF contained in the NetCDF C Interface Guide for version 3.6.2.
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.inqAttID | netcdf.inqDim | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |