Function File: x = ncread (filename, varname)
Function File: x = ncread (filename, varname,start,count,stride)

Read the variable varname from the NetCDF file filename.

If start,count and stride are present, a subset of the variable is loaded. The parameter start contains the starting indices (1-based), count is the number of elements and stride the increment between two successive elements. These parameters are vectors whose length is equal to the number of dimension of the variable. Elements of count might be Inf which means that as many values as possible are loaded.

If the variable has the _FillValue attribute, then the corresponding values are replaced by NaN (except for characters). NetCDF attributes scale_factor (default 1) and add_offset (default 0) are use the transform the variable during the loading:

x = scale_factor * x_in_file + add_offset

The output data type matches the NetCDF datatype, except when the attributes _FillValue, add_offset or scale_factor are defined in which case the output is a array in double precision.

Note that values equal to the attribute missing_value are not replaced by NaN (for compatibility).

Example

Read the data from variable ’mydata’ in the file test.nc.

data  = ncread('test.nc','mydata');

See also: ncwrite,ncinfo,ncdisp.

Package: netcdf