How do I read or understand this code?
6 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Brattv
2016 年 2 月 13 日
It is pretty much just a way to get information from the fields. Lets do an example. I will first make a hdf file
hinfo = hdf5info('example.h5')
This results in
hinfo =
Filename: 'example.h5'
LibVersion: '1.8.12'
Offset: 0
FileSize: 35072
GroupHierarchy: [1x1 struct]
The first part of the code i calling the "GroupHierarchy" field
hinfo.GroupHierarchy
Which returns
Filename: 'D:\Program Files (x86)\Matlab\toolbox\matlab\demos\example.h5'
Name: '/'
Groups: [1x4 struct]
Datasets: []
Datatypes: []
Links: []
Attributes: [1x2 struct]
The next part of the code is calling the Groups field with the location (1,3). This seems to return the whole row of field 3
From the command window
Filename: 'D:\Program Files (x86)\Matlab\toolbox\matlab\demos\example.h5'
Name: '/g3'
Groups: []
Datasets: [1x32 struct]
Datatypes: []
Links: []
Attributes: []
As you see, the "Group" field is empty in this case and there is no reason to call it. But we are able to call Datasets
hinfo.GroupHierarchy.Groups(1,3).Datasets(1,1)
Which returns
Filename: 'D:\Program Files (x86)\Matlab\toolbox\matlab\demos\example.h5'
Name: '/g3/VLstring'
Rank: 1
Datatype: [1x1 struct]
Dims: 2
MaxDims: 2
Layout: 'contiguous'
Attributes: []
Links: []
Chunksize: []
FillValue: ''
Hope this helped. I would also like to tell you that Matlab recommends that you use H5INFO instead of hdf5info.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!