MATLAB: How to import a lzf compressed HDF5 dataset in Matlab

h5readhdf5hdf5readlzw

Hello I try to open a lzf compressed HDF5 dataset in Matlab with h5read but I only get the below error.
Error using h5readc
The HDF5 library encountered an error and produced the following
stack trace information:
H5PL__find can't open directory
H5PL_load search in paths failed
H5Z_pipeline required filter 'lzf' is not registered
H5D__chunk_lock data pipeline read failed
H5D__chunk_read unable to read raw data chunk
H5D__read can't read data
H5Dread can't read data
Error in h5read (line 58)
[data,var_class] = h5readc(Filename,Dataset,start,count,stride);||
I also tried hdf5read but the same…
Error using hdf5readc
Reading from the dataset failed.
Error in hdf5read (line 95)
[data, attributes] = hdf5readc(settings.filename, ...
Does anybody has a good idea how to access lzf compressed datasets in hdf5 files? Thank you

Best Answer

As of R2015a, MATLAB upgraded to HDF5 1.8.12 and thus now supports reading HDF5 datasets via the new dynamically loaded filter feature (which includes LZF compression).
To use a custom filter, you must have the third-party filter as a shared library or DLL on your system and then set the HDF5_PLUGIN_PATH environment variable to point to the shared libraries. Note that if you are using Windows, there may be additional steps required to ensure compatibility between the CRT (C Run-time Libraries) of the Visual Studio builds of HDF5 and the third-party filter.
For releases prior to R2015a, MATLAB does not support LZF compression filters.
The high-level functions can be used to read HDF5 files with compression filters. To return information about the compression filter used, and other metadata about the file, use ' h5info'. To read the file, assuming that the compression filter used is supported by MATLAB, call ' h5read', and the decompression will be done automatically.