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
답변 (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!