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?
0 个评论
回答(1 个)
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).
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 HDF5 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!