Easy HDF5 / NetCDF4 / HDF4 Matlab interface

Using HDF5 / NetCDF4 / HDF4 from any language can be intimidating if directly using the low-level API. Interfaces have sprung up for popular languages that make HDF5 trivially easy to use, such as Python h5py.

The stdlib for Matlab provides functions making HDF5, NetCDF4, and HDF4 much easier to use in Matlab.

The “h5*” functions are for HDF5, “nc*” functions are for NetCDF4, and “h4*” functions are for HDF4. The functions are polymorphic, typecasting user data.

The h5*, nc*, and h4* functions work very similarly. For simplicity, we only show the h5* functions.

  • h5save() save a variable to a file
  • h5variables() list all the variable in a file
  • h5size() get the size (shape) of a variable in a file
  • h5exists() check if a variable exists in a file