FUNCTION REFERENCE
ncread
Read a variable from a NetCDF file.
Read a variable from a NetCDF file.
Syntax
vardata = ncread(source, varname)Syntax
vardata = ncread(source, varname, start, count)Syntax
vardata = ncread(source, varname, start, count, stride)Reads NetCDF classic files (CDF-1, 64-bit offset CDF-2 and 64-bit data CDF-5) and NetCDF-4 files. The size is the reverse of the order ncdump lists the dimensions, with the record (unlimited) dimension last. Values keep their class (double, single, integer, char for NC_CHAR). Values equal to the _FillValue or missing_value attribute become NaN in floating data; with scale_factor or add_offset the result is double, unpacked as value*scale_factor+add_offset, with fill and missing values NaN. start (one-based), count (Inf: to the end) and stride select part of the variable.
Example
t = ncread('weather.nc', 'temp')Example
first = ncread('weather.nc', 'temp', [1 1 1], [Inf Inf 1]) % the first recordDifferences from MATLAB: URLs (OPeNDAP) are not read. Integer data with a fill value but no scale or offset keeps the fill value. NetCDF-4 user-defined (compound, enum, vlen) and string variables are not supported; group variables are named 'group/var'. Not in the browser build.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.