How to read compound data with field of compound array type
3 views (last 30 days)
Show older comments
hi, I have a MATLAB data file saved in Matlab 2012a, which is MATLAB 7.3 format(actually it is a HDF5 file as documented), here I will describe the file content.
In MATLAB 2012a, I have a variable of compound type, let say the variable is 'BigGrp', this variable contains two fields, 'Junk' and 'BigGrpExtern', while 'Junk' is a text type, with value 'Mess'(4 character string), and 'BigGrpExtern' is a array of two element, each element is of a compound data with a member field named 'Strs', 'Strs' is a array of two element, which is of a compound data with two member fields named 'ID' and 'Name', of Integer type and Text type.
The output in MATLAB 2012a
>> BigGrp
BigGrp =
MyGrpExtern: [1x2 struct]
Junk: 'Mess'
Ext: [1x1 struct]
>> BigGrp.MyGrpExtern
ans =
1x2 struct array with fields:
Strs
My problem is: I need to read this data file into my application with HDF5 API(HDF5Dll.dll version 1.8.x), yet in HDFView 2.9, I see 'BigGrp' is treated as a Group, and 'BigGrpExtern' is a sub group, and 'BigGrpExtern' only have a Dataset named 'Strs', 'BigGrpExtern' does NOT have any attribute that indicate it contains two 'Strs' datasets. I know in HDF5, group does NOT have the concept of dimension, and the nested struct array(of 1 x 2) 'BigGrpExtern' in my MATLAB data file become a 'Strs' dataset in HDF5.
I wonder how I can get back all the data in 'BigGrpExtern', which is struct array(1 x 2) in MATLAB, but in HDF5, there is NO group array concept(or say group with dimension larger than 1 x 1).
I attach the sample file matlabv73Test.mat here, would you please help to check my problem kindly, thanks.
Sophy Huang
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on HDF5 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!