Writing Compound Data into Groups in HDF5 files
12 次查看(过去 30 天)
显示 更早的评论
I'm trying to write MATLAB data to an existing database of hdf5 files. Data in the database is currently being stored as table. The tables' columns can be different data types such as an integer or a string etc. and the columns also have labels like "longitude", "Name of patient" etc as a property of the table.
I posted a question about this and was helped out by being pointed towards the following link: http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/api18-m.html. I used the Write Compound Data script to solve the problem.
However, I need to nest the data inside a number of directories inside the hdf5 file. For example /hospital/patient/patientdata. I think the hdf5 terminology is "groups"
I worked out how to do this using MATLAB h5write command but this only works for numeric datasets and not the compound data that I'm trying to write. Could someone tell me what changes I need to make to the example script http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples/h5ex_t_cmpd.m to get it writing the data inside of a set of groups?
0 个评论
采纳的回答
John
2012-7-19
Change line 89 from
dset = H5D.create (file, DATASET, filetype, space, 'H5P_DEFAULT');
to (for example)
plist = 'H5P_DEFAULT';
g1 = H5G.create(file,'g1',plist,plist,plist);
g2 = H5G.create(g1,'g2',plist,plist,plist);
dset = H5D.create (g2, DATASET, filetype, space, 'H5P_DEFAULT');
You then get a dataset with full path name '/g1/g2/DS1'
You also have to change the line in the script that tries to re-open the dataset, just give it the full path name.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 HDF5 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!