Skip to main content

10.2) High Level Access: Reading


The arrays within a NetCDF file represent data as well as supporting attribute data.

Matlab has functions to read data and attributes. In its simplest form:

[matlab]
>> filename='data.nc'
>> ncdisp(filename);
>> data=ncread(filename, 'a');
>> a_info=ncreadatt(filename, 'a', 'description')
>>
[/matlab]

Command   Description Example
ncdisp Display text description of the contents ncdisp(filename)
ncinfo Gets information about a file or field finfo=ncinfo(filename)
ncinfo(filename, var_name)
ncread Reads data from a variable in a file data=ncread(filename, var_name)
ncreadatt Reads attribute data from a file att_value=ncreadatt(filename, var_name, att_name)