netcdf.getVar
Read data from NetCDF variable
Syntax
data = netcdf.getVar(ncid,varid)
data = netcdf.getVar(ncid,varid,start)
data = netcdf.getVar(ncid,varid,start,count)
data = netcdf.getVar(ncid,varid,start,count,stride)
data = netcdf.getVar(___,output_type)
Description
data = netcdf.getVar(ncid,varid)
returns data
, the
value of the variable specified by varid
.
MATLAB® attempts to match the class of the output data to
NetCDF class of the variable.
Note
For variables of type
NC_CHAR
, the
netcdf.getVar
function supports
reading only of data
that
contain only ASCII-encoded characters. NetCDF-4
files support writing UTF-8 -encoded characters in
variables of type
NC_STRING
.
ncid
is a NetCDF file identifier returned
by netcdf.create
or netcdf.open
.
data = netcdf.getVar(ncid,varid,start)
returns
a single value starting at the specified index, start
.
data = netcdf.getVar(ncid,varid,start,count)
returns
a contiguous section of a variable. start
specifies
the starting point and count
specifies the amount
of data to return.
data = netcdf.getVar(ncid,varid,start,count,stride)
returns
a subset of a section of a variable. start
specifies
the starting point, count
specifies the extent
of the section, and stride
specifies which values
to return.
data = netcdf.getVar(___,output_type)
specifies the data type
of the return value data
. Specify
output_type
as one of these
values:
'double'
'single'
'int64'
'uint64'
'int32'
'uint32'
'int16'
'uint16'
'int8'
'uint8'
'char'
This function corresponds to several functions in the NetCDF library C API. To use this function, you should be familiar with the NetCDF programming paradigm.