Open NetCDF data source


ncid =
ncid =,mode)
[chosen_chunksize, ncid] =,mode,chunksize)


ncid = opens source, which can be the name of a NetCDF file or the URL of an OPeNDAP NetCDF data source, for read-only access. Returns a NetCDF ID in ncid.

ncid =,mode) opens source with the type of access specified by mode, which can have any of the following values.

Value Description
'WRITE'Read-write access
'SHARE'Synchronous file updates
'NOWRITE'Read-only access (Default)

You can also specify mode as a numeric value that can be retrieved using netcdf.getConstant. Use these numeric values when you want to specify a bitwise-OR of several modes.

[chosen_chunksize, ncid] =,mode,chunksize) opens source, an existing netCDF data source, specifying the additional I/O performance tuning parameter, chunksize. The actual value used by the NetCDF library might not correspond to the input value you specify.

This function corresponds to the nc_open and nc__open functions 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®,

ncid ='','NOWRITE');
Was this topic helpful?