Read data from variable in NetCDF data source
vardata = ncread(source,varname)
vardata = ncread(source,varname,start,count,stride)
vardata = ncread(source,varname)
reads
data from the variable varname
in source
,
which can be either the name of a NetCDF file or an OPeNDAP NetCDF
data source.
vardata = ncread(source,varname,start,count,stride)
reads
data from the variable varname
in source
beginning
at the location given by start
. count
specifies
the number of elements to read along the corresponding dimension.
The optional argument stride
specifies the inter-element
spacing along each dimension.
|
Text string specifying the name of a NetCDF file or the URL of an OPeNDAP NetCDF data source. |
|
Text string specifying the name of a variable in the NetCDF file or OPeNDAP NetCDF data source. |
|
For an N-dimensional variable, |
|
Vector of length N specifying the number
of elements to read along the corresponding dimensions. If a particular
element of |
|
Optional argument that specifies the inter-element spacing along each dimension. Default: Vector of 1s (ones) |
|
The data in the variable.
|
Read and display the data in the peaks
variable
in the example file.
ncdisp('example.nc','peaks'); peaksData = ncread('example.nc','peaks'); peaksDesc = ncreadatt('example.nc','peaks','description'); surf(double(peaksData)); title(peaksDesc);
Subsample the peaks data by a factor of 2 (read every other value along each dimension).
subsetdata = ncread('example.nc','peaks',... [1 1], [Inf Inf], [2 2]); surf(double(subsetdata));