I am new to Matlab and am trying to reverse engineer a script used to read hdf5 files, need help with syntax for variables
2 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
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).
See Also
Categories
Find more on HDF5 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!