This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Return information about netCDF file


[ndims,nvars,ngatts,unlimdimid] = netcdf.inq(ncid)


[ndims,nvars,ngatts,unlimdimid] = netcdf.inq(ncid) returns the number of dimensions, variables, and global attributes in a netCDF file. The function also returns the ID of the dimension defined with unlimited length, if one exists.

ncid is a netCDF file identifier returned by netcdf.create or You can call netcdf.inq in either define mode or data mode.

This function corresponds to the nc_inq 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®,, and uses the netcdf.inq function to get information about the contents of the file.

% Open netCDF example file.
ncid ='','NC_NOWRITE')

% Get information about the contents of the file.
[numdims, numvars, numglobalatts, unlimdimID] = netcdf.inq(ncid)

numdims =


numvars =


numglobalatts =


unlimdimID =

Was this topic helpful?