1

I am basically trying to create an HDF5 file to store a single matrix of 16 bit integers in a dataset with a specific path. After reading the HDF5 Management section of the Scilab documentation I have tried the following:

file1 = h5open(‘/.../test.h5','a');
h5write(file1, '/example/data', variable, 'H5T_STD_I16LE');

In my understanding the first line should create the test.h5 file as I am using the 'a' parameter. The h5write according to the documentation should create the dataset if it does not exist, and write the supplied variable to it.

The file itself is indeed created however, the dataset is not created and the code returns the folowing error:

!--error 999 
h5write: Cannot create the dataset: /example/data
HDF5 description: component not found

Could someone please point out what I am missing here?

1 Answer 1

1

After some further experimentation with the h5 functions I have found a solution, and I thought I would answer my question as the answer is not stated clearly in the Scilab documentation.

In order to use h5write to create a dataset at e.g. /group/subgroup/dataset, the groups themselves have to be created first, as follows:

h5group(file, '/group');
h5group(file, '/group/subgroup')

One can then go on to create create the dataset at the path, as shown in the question.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.