This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

NetCDF Files

Network Common Data Form

Read or write NetCDF files using MATLAB® high-level functions or the NetCDF library package of low-level functions. High-level functions simplify the process of reading data from a NetCDF file or writing a variable from the MATLAB workspace into a NetCDF file.

For more control over the reading and writing process, use the NetCDF Library Package containing low-level functions. The low-level functions enable more control over the reading and writing process by providing access to the routines in the NetCDF C library.

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


expand all

nccreateCreate variable in NetCDF file
ncdispDisplay contents of NetCDF data source in Command Window
ncinfo Return information about NetCDF data source
ncreadRead data from variable in NetCDF data source
ncreadatt Read attribute value from NetCDF data source
ncwriteWrite data to NetCDF file
ncwriteattWrite attribute to NetCDF file
ncwriteschemaAdd NetCDF schema definitions to NetCDF file

Library Functions

netcdf.setChunkCacheSet default chunk cache settings for NetCDF library
netcdf.getChunkCacheRetrieve chunk cache settings for NetCDF library
netcdf.inqLibVersReturn NetCDF library version information
netcdf.setDefaultFormatChange default netCDF file format

File Operations

netcdf.abortRevert recent netCDF file definitions
netcdf.closeClose netCDF file
netcdf.createCreate new NetCDF dataset
netcdf.endDefEnd netCDF file define mode
netcdf.inqReturn information about netCDF file
netcdf.inqFormatDetermine format of NetCDF file
netcdf.inqGrpsRetrieve array of child group IDs
netcdf.inqUnlimDimsReturn list of unlimited dimensions in group
netcdf.openOpen NetCDF data source
netcdf.reDefPut open netCDF file into define mode
netcdf.setFillSet netCDF fill mode
netcdf.syncSynchronize netCDF file to disk


netcdf.defDimCreate netCDF dimension
netcdf.inqDimReturn netCDF dimension name and length
netcdf.inqDimIDReturn dimension ID
netcdf.renameDimChange name of netCDF dimension


netcdf.defGrpCreate group in NetCDF file
netcdf.inqDimIDsRetrieve list of dimension identifiers in group
netcdf.inqGrpNameRetrieve name of group
netcdf.inqGrpNameFullComplete pathname of group
netcdf.inqGrpParentRetrieve ID of parent group.
netcdf.inqNcidReturn ID of named group
netcdf.inqVarIDsIDs of all variables in group


netcdf.defVarFillDefine fill parameters for NetCDF variable
netcdf.inqVarDeflateDetermine compression settings for NetCDF variable
netcdf.defVarCreate NetCDF variable
netcdf.defVarChunkingDefine chunking behavior for NetCDF variable
netcdf.defVarDeflateDefine compression parameters for NetCDF variable
netcdf.defVarFletcher32Define checksum parameters for NetCDF variable
netcdf.getVarRead data from NetCDF variable
netcdf.inqVarInformation about variable
netcdf.inqVarChunkingDetermine chunking settings for NetCDF variable
netcdf.inqVarFillDetermine values of fill parameters for NetCDF variable
netcdf.inqVarFletcher32Fletcher32 checksum setting for NetCDF variable
netcdf.inqVarIDReturn ID associated with variable name
netcdf.putVarWrite data to netCDF variable
netcdf.renameVarChange name of netCDF variable


netcdf.copyAttCopy attribute to new location
netcdf.delAttDelete netCDF attribute
netcdf.getAttReturn netCDF attribute
netcdf.inqAttReturn information about netCDF attribute
netcdf.inqAttIDReturn ID of netCDF attribute
netcdf.inqAttNameReturn name of netCDF attribute
netcdf.putAttWrite netCDF attribute
netcdf.renameAttChange name of attribute


netcdf.getConstantReturn numeric value of named constant
netcdf.getConstantNamesReturn list of constants known to netCDF library


Import NetCDF Files and OPeNDAP Data

Read data from a NetCDF file using the high-level functions, and then read the file by using the netcdf package low-level functions.

Export to NetCDF Files

Create, merge, and write NetCDF files using high-level functions and the netcdf package low-level functions.

Map NetCDF API Syntax to MATLAB Syntax

MATLAB netcdf package of low-level functions and its correspondence with the NetCDF C library.


Resolve Errors Reading OPeNDAP Data

When you have trouble reading OPeNDAP data, consider these factors.

Related Information