MATLAB Answers

HDF5 V1.10

109 views (last 30 days)
Norton Allen
Norton Allen on 17 Mar 2018
Edited: Jarom Nelson on 18 Sep 2019
Can Matlab read/write HDF5 v1.10 files? If not, are there plans to add that support? I'm particularly interested in SWMR (Single Write Multiple Read) functionality, but I have not found any mention of that in the Matlab docs.

  0 Comments

Sign in to comment.

Accepted Answer

Talmo Pereira
Talmo Pereira on 18 Mar 2018
MATLAB as of R2018a cannot read v1.10 HDF5 files and therefore support SWMR. The HDF5 library version used in either R2017b or R2018a:
>> [ver_major,ver_minor,ver_patch] = H5.get_libversion
ver_major =
1
ver_minor =
8
ver_patch =
12
"Word of Caution: Please note that HDF5 files created with SWMR access cannot not be read by the tools based on the HDF5 1.8 libraries due to the file format changes in the HDF5 1.10 version of the library. [...] One can use the h5repack or h5format_convert tools to convert an HDF5 file created by the HDF5 Library version 1.10.0 to be accessible by the HDF5 Library version 1.8. The h5repack tool rewrites the whole file; h5format_convert modifies the file “in place” by rewriting only metadata information according to the 1.8 format while leaving raw data intact."
Here's what happens if you try to query a SWMR-enabled file:
>> h5disp('swmr_test.h5')
Error using h5infoc
The filename specified was either not found on the MATLAB path or it contains unsupported characters.
Error in h5info (line 102)
hinfo = h5infoc(filename,location, useUtf8);
Error in h5disp>display_hdf5 (line 112)
hinfo = h5info(options.Filename,options.Location);
Error in h5disp (line 90)
display_hdf5(options);
Using the commandline tool provided with the official library:
>> !h5ls swmr_test.h5
x Dataset {64, 64, 1, 1000/Inf}
It would be terrific if MathWorks considered reaching feature parity with the HDF5 library or leading wrappers like h5py within at least 1-2 years of breaking changes :)...

  4 Comments

Show 1 older comment
Talmo Pereira
Talmo Pereira on 3 Jul 2018
Yeah the Python solution is what I've been doing. I use something like this SO answer using h5py.Group.copy and create the output file with:
h5py.File("output.h5", "w", libver="earliest")
Jasmin Jestel
Jasmin Jestel on 4 Jul 2018
Thank you for your help, it is much appreciated!
Paul Ryan
Paul Ryan on 17 Oct 2018
I still can't get this to work in python. Would you be able to share exactly what you did?

Sign in to comment.

More Answers (1)

Jarom Nelson
Jarom Nelson on 18 Sep 2019
Edited: Jarom Nelson on 18 Sep 2019
h5repack and h5format_convert are available with the HDF5 1.10.x software to update a file to be compatible with HDF5 1.8.x.
One can use the h5repack or h5format_convert tools to convert an HDF5 file created by the HDF5 Library version 1.10.0 to be accessible by the HDF5 Library version 1.8. The h5repack tool rewrites the whole file; h5format_convert modifies the file “in place” by rewriting only metadata information according to the 1.8 format while leaving raw data intact.

  0 Comments

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!