README!: Please note that there is a major change as of release 3344 (November 21, 2010) for users whose version of MATLAB is R2008a or below. Please read these new instructions very carefully, otherwise you will encounter serious problems.
MATLAB does not have a native interface for R2006a through R2008a, so we have to enable at least one third party backend. But first, download SNCTOOLS (current as of svn commit # 4053) and read the README. Please note that your browser may unzip the download for you, so you need to be aware of that. The instructions below assume that it is not unzipped.
The easiest backend to install is to choose netcdf-java for read-only support, so download version 4.1.1 of netcdf-java from Unidata. If you have downloaded both into the same directory, you can then finish the install in matlab by changing into that directory and
javaaddpath([pwd '/netcdfAll-4.1.1.jar']); javaaddpath ([pwd '/mexcdf/snctools/classes']); unzip('mexcdf.r4053.zip') addpath ([pwd '/mexcdf/mexnc']); addpath ([pwd '/mexcdf/snctools']);You will also be able to read classic model netCDF-4 files and OPeNDAP URLs with netcdf-java.
You can test out your installation with
test_snctools()Please let me know if this does not work for you.
If you need to be able to create or modify netcdf files, however, you are not quite yet done yet, as you also need a mex-file that is specific to your version of MATLAB, so click on the appropriate link below. And if you do not wish to install netcdf-java, then you Must install the mex-file. When you unpack the mex-file download, you need the mex-file to be placed into the mexcdf/mexnc/private directory. Windows users must consult the README in the mexnc directory for additional instructions. Now, suppose that your version of matlab is R2007a and you are not on windows and you downloaded that file from down below to the very same directory that SNCTOOLS and netcdf-java were downloaded. Your installation steps then become
unzip('mexcdf.r4053.zip') unzip('netcdfAll-4.2.zip') unzip('mexnc.R2007a.r2713-2.zip') addpath ([pwd '/mexcdf/mexnc']); addpath ([pwd '/mexcdf/snctools']); javaaddpath([pwd '/netcdfAll-4.1.1.jar']); javaaddpath ([pwd '/mexcdf/snctools/classes']);and you can test this out with
cd mexcdf/snctools/tests test_snctools cd ../../mexnc/tests test_mexnc
Please note that there is no native mexnc mex-file for win64.