How to change the type when creating HDF5 attributes.
8 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Les Beckham
2022 年 4 月 1 日
編集済み: Les Beckham
2022 年 4 月 1 日
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?
回答 (1 件)
Les Beckham
2022 年 4 月 1 日
編集済み: Les Beckham
2022 年 4 月 1 日
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 件のコメント
Les Beckham
2022 年 4 月 1 日
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.
参考
カテゴリ
Help Center および File Exchange で HDF5 についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!