How to save struct array into H5
显示 更早的评论
Hi guys
I have this simple struct array wdata, has 4 fileds and saved as struct array
FieldA =int32([1153 ; 1184 ; 1027;11 ]);
FieldB ={'Exterior (static)', 'Intake',...
'Intake manifold','test'};
FieldArray = [randn(1,ADIM0);randn(1,ADIM0);randn(1,ADIM0);randn(1,ADIM0)];
FieldC =int32([11 ; 12 ; 13; 14]);
for i = 1:DIM0
wdata(i).FieldA =FieldA(i);
wdata(i).FieldB =FieldB(i);
wdata(i).FieldArray = FieldArray(i);
wdata(i).FieldC = FieldC;
end
I want to save wdata into h5 as compound, but I got stuck with memory assigning
can anyone help?
thansk
回答(1 个)
Shivam Lahoti
2023-11-16
Hi Kat Lee,
I can understand that you want to save the ‘wdata’ struct array into an HDF5 file as a compound datatype. However, you mentioned that you encountered issues with memory assignment.
You shall use the functions ‘h5create’ to create the HDF5 file and define the compound datatype and ‘h5write’ to write each struct element to the HDF5 file.
Execute this command into your MATLAB window to understand the implementation of both functions with the help of an example.
openExample('matlab/WriteToEntireDataSetExample')
Refer to the documentation below for more clarity.
I hope this was helpful.
Regards,
Shivam Lahoti.
类别
在 帮助中心 和 File Exchange 中查找有关 App Building 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!