How to save .mat file into hdf5 in matlab?

43 visualizaciones (últimos 30 días)
Faheem Ur Rehman
Faheem Ur Rehman el 18 de Sept. de 2021
Comentada: Star Strider el 19 de Sept. de 2021
I have .mat file and i want to convert them into dataset using h5write but i got error.
a = load('file.mat');
h5write('a.h5', a)
Error
Error using h5write (line 96)
The value of 'Data' is invalid. Expected DATA to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64, string
Instead its type was struct.

Respuestas (1)

Star Strider
Star Strider el 18 de Sept. de 2021
I have no recent experience with HDF5 files, however the h5write documentation for data indicates that it must be a numeric matrix or a MATLAB string array. Depending on what the structure contains, the struct2table (or struct2cell) functions would likely be required first, then table2array for a table.
That appears to me to be more involved than it should be, however that appears to be the only option.
And that only if the original structure and the data in it permits those conversions.
.
  2 comentarios
Faheem Ur Rehman
Faheem Ur Rehman el 19 de Sept. de 2021
Thank you for your answer. I have what you write. but write now facing another error. please help
Error using h5create (line 98)
The value of 'Size' is invalid. Expected SIZE to be nonnegative.
Star Strider
Star Strider el 19 de Sept. de 2021
I cannot help you with that, other than to caution you to be certain that 'Size' is greater than 0.
.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by