How to change the type when creating HDF5 attributes.
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi all,
I want to create attributes for a HDF5 file like this which is read from HDFView:
and here is my Matlab code:
h5writeatt('tt.h5','/tide','Dimension', "XY");
h5writeatt('tt.h5','/tide','Discretization', [2.0 3.0]);
h5writeatt('tt.h5','/tide','Origin', [-1.0 -1.0]);
h5writeatt('tt.h5','/tide','Max Buffer Size', int32(4));
h5writeatt('tt.h5','/tide','Cell Centered', "TRUE");
h5writeatt('tt.h5','/tide','Time Units', "d");
then I read it in HDFView, and the result is:
How shoud I change the type when creating the attributes? And the type of "Transient" is like BOOL, how shoud I set this type?
Thanks,
Peter
2 Kommentare
Les Beckham
am 1 Apr. 2022
Bearbeitet: Les Beckham
am 1 Apr. 2022
If I read your question correctly you are primarily concerned with the type of the "Transient" attribute, but you didn't show the code you used to write that attribute. What was the type of the data you wrote to that attribute? Was it logical or a string or a number?
Antworten (1)
Les Beckham
am 1 Apr. 2022
Bearbeitet: Les Beckham
am 1 Apr. 2022
I don't have any hd5 files to test this with, but I suspect that if you change this
h5writeatt('tt.h5','/tide','Transient', "TRUE");
to this
h5writeatt('tt.h5','/tide','Transient', true);
you may achieve what you want.
"TRUE" is not a boolean (logical) value, it is a string.
4 Kommentare
Les Beckham
am 1 Apr. 2022
You are welcome. Sorry it didn't help.
Good luck.
If your Matlab is under maintenance, you might want to contact Mathworks support to see if they can help. There is a "Contact Support" link at the bottom of this page.
Siehe auch
Kategorien
Mehr zu HDF5 finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!