Skip to Main Content Skip to Search
Product Documentation

netcdf.open - Open NetCDF data source

Syntax

ncid = netcdf.open(source, mode)
[chosen_chunksize, ncid] = netcdf.open(source, mode, chunksize)

Description

ncid = netcdf.open(source, mode) opens source, which can be the name of a NetCDF file or the URL of an OPeNDAP NetCDF data source, with the type of access specified by mode. Returns a NetCDF ID in ncid.

mode can have any of the following values.

Value Description
'NC_WRITE'Read-write access
'NC_SHARE'Synchronous file updates
'NC_NOWRITE'Read-only access

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

[chosen_chunksize, ncid] = netcdf.open(source, 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.

Examples

This example opens the example NetCDF file included with MATLAB, example.nc.

ncid = netcdf.open('example.nc','NC_NOWRITE');
netcdf.close(ncid);

See Also

netcdf.create | netcdf.getConstant

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS