How to save .mat file into hdf5 in matlab?

조회 수: 43 (최근 30일)
Faheem Ur Rehman
Faheem Ur Rehman 2021년 9월 18일
댓글: Star Strider 2021년 9월 19일
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.

답변 (1개)

Star Strider
Star Strider 2021년 9월 18일
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
Faheem Ur Rehman
Faheem Ur Rehman 2021년 9월 19일
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 2021년 9월 19일
I cannot help you with that, other than to caution you to be certain that 'Size' is greater than 0.
.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by