How to save .mat file into hdf5 in matlab?
42 ビュー (過去 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!