Writing Compound Data to an Existing HDF5 file
6 views (last 30 days)
Show older comments
I'm having difficulty adding a new compound dataset to an existing hdf5 file.
I get an error along the lines of:
***********************
Error using hdf5lib2 The HDF5 library encountered an error during execution of the 'H5Dcreate1' function, 'unable to create dataset'.
Error in H5D.create (line 40) id = H5ML.hdf5lib2('H5Dcreate', varargin{:} );
**************************
The easiest way to recreate this error is using the example script for writing MATLAB compound data to a hdf5 file on the hdfgroup.org website: http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/matlab/HDF5_M_Examples/h5ex_t_cmpd.m
Basically, I run the script once so it create a file. Then I change
DATASET = 'DS1';
to
DATASET = 'DS2';
and
file = H5F.create(fileName);
to
file = H5F.open (fileName);
The aim is to create an identical dataset called DS2 inside of the same file as DS1. However, MATLAB throws the above error.
Any ideas what I'm doing wrong?
0 Comments
Accepted Answer
John
on 25 Jul 2012
You are opening the file in read-only mode, which is why the H5D.create call fails. Check the help for H5F.open, it has an example of what you need to do to modify your code.
More Answers (0)
See Also
Categories
Find more on HDF5 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!