How to save .mat file into hdf5 in matlab?
43 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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 个评论
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!