A Matlab toolbox for working with common data model datasets

nctoolbox is a Matlab toolbox that provides read-only access to common data model datasets. Under the hood, nctoolbox uses NetCDF-Java as the data access layer. This allows nctoolbox to access NetCDF, OPeNDAP, HDF5, GRIB, GRIB2, HDF4 and many (15+) other file formats and services using the same API. It works with Matlab 2008a and later.

Checkout the Published Demos Gallery

Take a look at the WIKI Documentation

Get Started

Older instructions and documentation at:

We are in the progress of moving the project hosting

The new documentation will be here at

Why Use nctoolbox?

Two words: it's simple

It's simple to install!

Download it and run the setup_nctoolbox. Thats it.

It's simple to use!

All types of datasets (NetCDF, HDF5, OpenDAP) are read exactly the same way. Want to read data from an OpenDAP URL?

ds = ncgeodataset('')
time_run ='time_run');

Want to subset data, NetCDF style (i.e Start, End, Stride)?

lwrad ='lwrad', [10000 100 400], [10100 105 400]) % No Stride
lwrad ='lwrad', [10000 100 400], [10100 105 400], [1 1 1]) % With Stride

Want to subset data, Matlab style?

lwrad = ds{'lwrad'}(10000:10100, 100:105, 400)


Matlab R2008a+. You can verify the version of Matlab by typing:


Java 6+. You can verify the version of Java used by Matlab by typing:


The version returned should start with 'Java 1.6'. If it starts with 'Java 1.5' you can try updating the Matlab JVM: or use the older nctoolbox-20091112 version of this toolbox.


In Matlab, change to the nctoolbox directory. For example,

cd ~/Documents/MATLAB/nctoolbox

Run the setup_nctoolbox.m function


This sets up nctoolbox for the current Matlab session only. You will need to add the follwing lines to your startup.m file if you would like nctoolbox automatically when you start Matlab:

% Edit '/Path/to/nctoolbox' to correct nctoolbox directory