Creating and writing to netCDF files requires either the mex-file or R2008b and better as a backend for SNCTOOLS. Creating netCDF files with the java backend is not supported.
Before actually creating a netCDF file, let's figure out what we want to create in the first place. Suppose we have a rectangular time series grid of data. The spatial dimensions of the data are latitude and longitude.
Creating an empty netCDF file is as simple as using the rather
aptly-named nc_create_empty.m
m-file as so.
nc_create_empty ( 'test.nc' ) nc_dump ( 'test.nc' )
netcdf test.nc { }