I am new to Matlab and am trying to reverse engineer a script used to read hdf5 files, need help with syntax for variables

조회 수: 4 (최근 30일)
I am new to matlab, and I am attempting to reverse engineer a script used to read hdf5 files. I have a dummy hdf5 file I am using to test it with and I am not sure the file has the correct # of attributes or columns.
the file structure is set up thus:
/Nodes
/Nodes/EmitterSystem
/Nodes/EntityState
with datasets under the EmitterSystem and EntityState groups. the file I have says it only has 1 attribute, which is the filename, however I have a section of code:
[AttributeSize ~] = size(HDF5Info.Datasets(a).Attributes);
for i=1:AttributeSize
AttributeIndex(i,1) = cellstr(HDF5Info.Datasets(a).Attributes(i).Name);
end
which to me looks like it is cycling through the attributes, then below it is trying to do a strcmp to compare values and set names if the values are correct. it keeps erroring out saying it is not getting the correct number of arguments. To me it looks as if the Attributes are incorrect, would that be a correct assumption?

답변 (1개)

Richard Burnside
Richard Burnside 2023년 6월 26일
You could just remove the semi-colon from the end of the AttributeSize line:
[AttributeSize ~] = size(HDF5Info.Datasets(a).Attributes)
and then you will be able to see if there are actual Attributes encoded in the HDF5 file ([AttributeSize ~] will be displayed).
  댓글 수: 1
Mike
Mike 2023년 6월 26일
Yeah, the hdf5viewer you can get from the hdf5 group will show you also, I did what you suggested and confirmed that there is only 1 attribute, and that is the filename, so my current theory since both MATLAB and python are erroring out once it trys to process the attributes is that there is a problem with the file.

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

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by