NetCDF-4

If you wish to read/write netCDF-4 files, you've got some choices to make, because as of MATLAB version R2009b, the native netcdf package supports the netCDF library version 3.6.2, which will not read netCDF-4 files.

SNCTOOLS and JAVA

Since MATLAB can use java jar files, it turns out that the trick for reading OPeNDAP datasets will also work here. In other words, the SNCTOOLS java backend will read netCDF-4 files. To enable the java backend, go the OPeNDAP page and follow the instructions there.

MATLAB's HDF5 Interface

NetCDF-4 files are really HDF5 files under the hood (very special HDF5 files...) As of R2009a, MATLAB does support HDF5 version 1.8.1, meaning that the HDF5 interface can be used to access netCDF-4 files. A decent set of tools is HDF5TOOLS, which is forms a wrapper around MATLAB's native HDF5 low-level interface. However, this will treat netCDF-4 files as if they were HDF5 files, meaning that some of the semantics are lost. For this reason, I would not use HDF5TOOLS to write to netCDF-4 files. It's perfectly safe to read using them, however.

MEXNC As A Last Resort

It's also possible to compile mexnc with netCDF-4 support, but you should only do this if you absolutely must WRITE netCDF-4 files. Here's how you might do this on a maci64 machine running R2009b.

And that should do it. You should now be able to read/write classic model netcdf-4 files within MATLAB.