Writing Compound Data into Groups in HDF5 files
조회 수: 14 (최근 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!