netcdf package of low-level functions and its correspondence with
the NetCDF C library.
MATLAB provides access to the routines in the NetCDF C
library through a set of low-level functions that are grouped into
a package called
netcdf. Use the functions in this
package to read and write data to and from NetCDF files. To use the MATLAB NetCDF
functions effectively, you should be familiar with the NetCDF C interface.
Usually, the MATLAB functions in the
correspond directly to routines in the NetCDF C library. For example,
the MATLAB function
to the NetCDF library routine
nc_open. In some
cases, one MATLAB function corresponds to a group of NetCDF library
functions. For example, instead of creating MATLAB versions of
every NetCDF library
type represents a data type, MATLAB uses
netcdf.putAtt, to handle all supported
To call one of the functions in the
you must prefix the function name with the package name. The syntax
of the MATLAB functions is similar to the NetCDF library routines.
However, the NetCDF C library routines use input parameters to return
data, while their MATLAB counterparts use one or more return
values. For example, this is the function signature of the
in the NetCDF library:
int nc_open (const char *path, int omode, int *ncidp); /* C syntax */
The NetCDF file identifier is returned in the
This is the signature of the corresponding MATLAB function,
ncid = netcdf.open(filename, mode)
Like its NetCDF C library counterpart, the MATLAB NetCDF
function accepts a file name and a constant that specifies the access
mode. However, that the MATLAB
returns the file identifier,
ncid, as a return
The MATLAB NetCDF functions automatically choose the MATLAB class that best matches the NetCDF data type. This table shows the default mapping.
|NetCDF Data Type||MATLAB Class|
[a] NetCDF interprets byte data as either signed or unsigned.
You can override the default and specify the class of the return
data by using an optional argument to the