How do I read or understand this code?

조회 수: 6 (최근 30일)
Anonymous
Anonymous 2016년 2월 13일
댓글: Anonymous 2016년 2월 14일
"hinfo.GroupHierarchy.Groups(1,3).Groups(1,1).Groups(1,2).Groups,2"
Where,
  • hinfo = hdf5info(dateiname);
  • dateiname = [dateirumpf '.H5'];
  • dateirumpf is a character string.

채택된 답변

Brattv
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.
  댓글 수: 1
Anonymous
Anonymous 2016년 2월 14일
Well explained Mr. Brattland. Thank you very much.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 HDF5에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by