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개)
참고 항목
카테고리
Help Center 및 File Exchange에서 HDF5에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!