H5 - How to create attribute within a group?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
EDIT: issue fixed- loc_id should be change to gid
Hello,
I am trying to create an attribute ('BoxSize') within a group ('Header') using H5 library.
my code generates the attribute outside the group.
I've tried to change HeaderAtt to "/Header/BoxSize" but it did not help.
I am using MATLAB R2018b.
thanks in advance.
fcpl = H5P.create('H5P_FILE_CREATE');
fapl = H5P.create('H5P_FILE_ACCESS');
fid = H5F.create('newfile.hdf5','H5F_ACC_TRUNC',fcpl,fapl);
plist = 'H5P_DEFAULT';
%create Groups
Group=["/Header";"PartType0";"/RuntimePars";"/Units"];
for i=1:numel(Group)
gid = H5G.create(fid,Group(i),plist,plist,plist);
end
HeaderAtt="BoxSize";
acpl_id = H5P.create('H5P_ATTRIBUTE_CREATE');
type_id = H5T.copy('H5T_NATIVE_DOUBLE');
space_id = H5S.create('H5S_SCALAR');
attr_id = H5A.create(fid,HeaderAtt,type_id,space_id,acpl_id);
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur HDF5 dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!