netcdf.inq
返回有关 netCDF 文件的信息
语法
[ndims,nvars,ngatts,unlimdimid] = netcdf.inq(ncid)
说明
[ndims,nvars,ngatts,unlimdimid] = netcdf.inq(ncid) 返回 netCDF 文件中维度、变量和全局属性的数目。该函数还会返回按无限长度定义的维度 ID,如果存在的话。
ncid 是 netcdf.create 或 netcdf.open 返回的 netCDF 文件标识符。您可以在定义模式或数据模式下调用 netcdf.inq。
此函数对应于 netCDF 库 C API 中的 nc_inq 函数。要使用此函数,应该熟悉 netCDF 编程范式。
示例
本例打开 MATLAB® 随附的 netCDF 示例文件 example.nc,并使用 netcdf.inq 函数获取有关文件内容的信息。
% Open netCDF example file.
ncid = netcdf.open('example.nc','NC_NOWRITE')
% Get information about the contents of the file.
[numdims, numvars, numglobalatts, unlimdimID] = netcdf.inq(ncid)
numdims =
4
numvars =
4
numglobalatts =
1
unlimdimID =
3