Writing Compound Data to an Existing HDF5 file

9 次查看(过去 30 天)
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?

采纳的回答

John
John 2012-7-25
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.

更多回答(0 个)

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by