NetCDF in Matlab

Posting on behalf of an OOI User

Hello OOI: are you able to work with NetCDF-3 files in Matlab? If so, I’d be grateful for a small test file.

Example below:

Example file:
https://www.unidata.ucar.edu/software/netcdf/examples/tos_O1_2001-2002.nc

Matlab code snippet:
time=ncread('tos_O1_2001-2002.nc ',‘time’)+datenum(2001,1,1);
sst=ncread('tos_O1_2001-2002.nc ',‘tos’);
lat=ncread('tos_O1_2001-2002.nc ',‘lat’);
lon=ncread(‘tos_O1_2001-2002.nc ‘,‘lon’);
plot(time,squeeze(sst(100,100,:)-273.15))
datetick(‘x’,1)
ylabel(’^oC’)
title([‘Lat: ’ num2str(lat(100)) ‘^oN Lon: ’ num2str(lon(100)),’^oE’])

Output:
image