Clear Filters
Clear Filters

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

1 view (last 30 days)
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?

Answers (1)

Richard Burnside
Richard Burnside on 26 Jun 2023
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 Comment
Mike
Mike on 26 Jun 2023
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.

Sign in to comment.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!