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.


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


Character vector that specifies the format of the NetCDF file. Returned values include:

'FORMAT_CLASSIC'Classic format — Original NetCDF format, used by all NetCDF files created between 1989 and 2004
'FORMAT_64BIT'Classic format, 64–bit — Original format with 64–bit addressing capability to allow creation and access of much larger files.
'FORMAT_NETCDF4'Enhanced model, HDF5-based — Introduced in 2008, NetCDF, version 4, extends the classic model and is based on HDF5.
'FORMAT_NETCDF4_CLASSIC' Classic 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?