This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
As Rich points out, matlab version R2010b has native support for reading and writing netCDF-4 files, both classic and enhanced models. It does so by mapping the C APIs into matlab's package concept, so using it directly does require some familiarity with the netCDF C library. If one does not have R2010b yet, then things get complicated. SNCTOOLS on sourceforge (written by me) may be worth a look. It sits on top of either matlab's native package, netcdf-java, or the older community mex-file and will switch back and forth between backends as necessary, depending on what version of matlab one has and what kind of file one has. The netcdf-java backend gives users at least read-support for netCDF-4 (matlab versions R2006a through R2010a). If someone you know needs netCDF-4 write-support and doesn't have R2010b, I would suggest telling them to contact me directly. On Friday 10 December 2010 09:38:29 Rich Signell wrote: > Jon, John & Co, > > Either of the netcdf-java toolboxs can read NetCDF4. I wouldn't say > either is "preferred" at this point. NC toolbox is easier to install, > uses more modern features of Matlab and is much simpler coding. NJ > toolbox has more functionality and works with older versions of > Matlab, but is more complex. > > The native Matlab interface also supports both reading and writing of > NetCDF4, at least in Matlab 2010b. Check out the m-file in the > attached .zip. > > > -Rich > > On Fri, Dec 10, 2010 at 9:25 AM, John Caron <address@hidden> wrote: > > On 12/10/2010 8:57 AM, Jon Blower wrote: > > > > Hi Rich, John and Russ, > > > > We've had an enquiry here about whether Matlab can read NetCDF4 files > > (which I think means compressed data with the classic data model), either > > "natively" (presumably through the C libraries) or through the > > Matlab-Java interface. Do you know if anyone has achieved this? > > > > Cheers, Jon > > > > matlab can use the java-netcdf4 library, which gives it access to all the > > CDM files, including netcdf4. > > > > there are 2 matlab toolkits: > > > > MATLAB toolkits > > > > njTBX (Rich Signell/USGS, Sachin Bhate/Mississippi State University) > > nctoolbox (Brian Schlining/MBARI) > > > > rich, which one is preferred?