| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
[xtype,attlen] = netcdf.inqAtt(ncid,varid,attname)
[xtype,attlen] = netcdf.inqAtt(ncid,varid,attname) returns the data type, xtype, and length, attlen, of the attribute identified by the text string attname.
ncid is a netCDF file identifier returned by netcdf.create or netcdf.open.
varid identifies the variable that the attribute is associated with. To get information about a global attribute, specify netcdf.getConstant('NC_GLOBAL') in place of varid.
This function corresponds to the nc_inq_att 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, and gets information about an attribute in the file.
% Open netCDF example file.
ncid = netcdf.open('example.nc','NOWRITE');
% Get identifier of a variable in the file, given its name.
varid = netcdf.inqVarID(ncid,'avagadros_number');
% Get attribute name, given variable id and attribute number.
attname = netcdf.inqAttName(ncid,varid,0);
% Get information about the attribute.
[xtype,attlen] = netcdf.inqAtt(ncid,varid,'description')
xtype =
2
attlen =
31
% Get name of global attribute
gattname = netcdf.inqAttName(ncid,netcdf.getConstant('NC_GLOBAL'),0);
% Get information about global attribute.
[gxtype gattlen] = netcdf.inqAtt(ncid,netcdf.getConstant('NC_GLOBAL'),gattname)
gxtype =
2
gattlen =
11netcdf.inqAttID netcdf.inqAttName

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