To export data in NetCDF format in Matlab, you can use the built-in NetCDF tools available in Matlab. Here are the general steps to export data in NetCDF format:
netcdf.create
function to create a new NetCDF file or netcdf.open
function to open an existing NetCDF file for writing.main.m48 chars2 lines
netcdf.defDim
, netcdf.defVar
and netcdf.putAtt
functions for that.main.m289 chars11 lines
netcdf.putVar
function to write the data to the NetCDF file.main.m94 chars6 lines
netcdf.close
function to close the NetCDF file.main.m20 chars2 lines
This will create a NetCDF file 'example.nc' with the data variable 'data' and the defined attributes 'long_name' and 'units'.
gistlibby LogSnag