netcdf.inqAttID
返回 netCDF 属性的 ID
语法
attnum = netcdf.inqAttID(ncid,varid,attname)
说明
attnum = netcdf.inqAttID(ncid,varid,attname) 检索由 attname 指示的属性标识符 attnum。以字符向量或字符串标量形式指定 attname。
varid 指定该属性所关联的变量。
ncid 是 netcdf.create 或 netcdf.open 返回的 netCDF 文件标识符。
此函数对应于 netCDF 库 C API 中的 nc_inq_attid 函数。要使用此函数,应该熟悉 netCDF 编程范式。
示例
本例打开 MATLAB® 随附的 netCDF 示例文件 example.nc。
% Open the netCDF example file.
ncid = netcdf.open('example.nc','NC_NOWRITE');
% Get the identifier of a variable in the file.
varid = netcdf.inqVarID(ncid,'avagadros_number');
% Retrieve the identifier of the attribute associated with the variable.
attid = netcdf.inqAttID(ncid,varid,'description');