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.

 Respuesta aceptada

Talmo Pereira
Talmo Pereira el 18 de Mzo. de 2018

4 votos

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 comentarios

Jasmin Jestel
Jasmin Jestel el 2 de Jul. de 2018
Editada: Jasmin Jestel el 2 de Jul. de 2018
Dear Talmo,
I encountered the same problem as Norton when i was trying to read a recently created hdf5 file (.h5) in matlab. When searching the internet for a way to solve this problem, i found your reply. I downlaoded the hdf5 software and tried to call the mentioned h5format_convert function from the windows command line. Unfortunately, it was unsuccessful, probably because i specified the option and/or parameter wrong. Could you possibly share an example of how you call the function? Or would you advise me to download Anaconda and use the Python work package?
Best regards, JJ
Talmo Pereira
Talmo Pereira el 3 de Jul. de 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 el 4 de Jul. de 2018
Thank you for your help, it is much appreciated!
Paul Ryan
Paul Ryan el 17 de Oct. de 2018
I still can't get this to work in python. Would you be able to share exactly what you did?

Iniciar sesión para comentar.

Más respuestas (2)

Alexander Neumann
Alexander Neumann el 29 de Jun. de 2021

1 voto

MATLAB 2021b (Prerelease)
>> [majnum,minnum,relnum] = H5.get_libversion()
majnum =
1
minnum =
10
relnum =
7
so it has finally been updated
Jarom Nelson
Jarom Nelson el 18 de Sept. de 2019
Editada: Jarom Nelson el 18 de Sept. de 2019

0 votos

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.

Etiquetas

Preguntada:

el 17 de Mzo. de 2018

Respondida:

el 29 de Jun. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by