Installing the netCDF Toolbox
The directions on the main website (see link on previous page) is pretty straightforward. Once you have downloaded the toolbox and followed the installation directions, add the toolbox paths using 'addpath'. It's convenient to add these paths in your individual 'startup.m' script, located in ~/matlab.

Accessing Data
Download this example netCDF file (output created using a idealized model from the University of Washington) to test out the toolbox.

First, take a look at the netCDF header using 'ncdump' in a terminal window. (*If you can't find 'ncdump' on your computer, open the netcdf file in matlab (see below) and type 'ncdump(fid)')

ncdump -h example.cdf | more
Notice the various sections: dimensions, variables, and global attributes. We will use a different toolobx command to read in each data type.
fid = netcdf('example.cdf');	% open the file

nx = size(fid('nx'))		% dimensions
nz = size(fid('nz'))
time = fid{'time'}(:);

z = fid{'sgz'}(:);		% variables
u = fid{'u'}(:);
v = fid{'v'}(:);

dx = fid.x_delta(1)		% global attributes
X = fid.x_min(1):dx:fid.x_max(1); 
We can also choose to load only a subset of a variable.
thet = fid{'thet'}(:,1,1,:);	% load the surface data only (time, z, y, x)
p = repmat(squeeze(fid{'p0'}(1,1,1,:)),[length(time) 1]) + squeeze(fid{'p'}(:,1,1,:));
				% total p = p0 + p'
T = squeeze(thet) .* (p/1e5).^(2/7);
				% calculate T from theta and p

close(fid)			% close the file