How to save struct array into H5
Mostrar comentarios más antiguos
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 comentario
Respuestas (1)
Shivam Lahoti
el 16 de Nov. de 2023
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.
Categorías
Más información sobre App Building en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!