This is machine translation

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


Determine format of NetCDF file


format = netcdf.inqFormat(ncid)


format = netcdf.inqFormat(ncid) returns the format for the file specified by NetCDF file identifier, ncid.

Input Arguments


Identifier of a NetCDF file, returned by netcdf.create or, or of a NetCDF group, returned by netcdf.defGrp.

Output Arguments


Text string that specifies the format of the NetCDF file. Values include:

Format StringDescription
FORMAT_CLASSICClassic format — Original NetCDF format, used by all NetCDF files created between 1989 and 2004
FORMAT_64BITClassic format, 64–bit — Original format with 64–bit addressing capability to allow creation and access of much larger files.
FORMAT_NETCDF4Enhanced model, HDF5-based — Introduced in 2008, NetCDF, version 4, extends the classic model and is based on HDF5.
FORMAT_NETCDF4_CLASSICClassic model, HDF5-based — Introduced in 2008, NetCDF, version 4, implements classic model but is based on HDF5.


This example opens the sample NetCDF file and determines the format.

ncid ='','NOWRITE');
fmt = netcdf.inqFormat(ncid)

format =




This function corresponds to the nc_inq_format function in the NetCDF library C API.

For copyright information, read the netcdfcopyright.txt and mexnccopyright.txt files.

Was this topic helpful?