How can I overwrite only one dataset without affecting other datasets in an HDF-file using HDF5WRITE in MATLAB 7.7 (R2008b)?

42 views (last 30 days)
I can read in one dataset from a file by specifying the dataset name in the HDF5READ command, but I am not able to overwrite just one of the datasets in the file using HDF5WRITE. The only options as I understand are:
1) Overwrite the whole file
2) append the dataset. But the condition here is that there shouldn't be an existing dataset with the same name.
I wanted to modify only one dataset in an existing HDF5 file without affecting the other datasets.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Sep 2012
As of MATLAB 7.13 (R2011a), HDF5WRITE has been deprecated by H5WRITE and H5CREATE.
The new syntax is,
% Create a dataset called "a" in the group "data" in the file "file.h5".
% Make that a one-dimensional dataset with one element
h5create('file.h5','/data/a',1)
% Write the value, 1000, to the dataset that was just created
h5write('file.h5','/data/a',1000);
% Overwrite the previous value
h5write('file.h5','/data/a',5000);

More Answers (1)

Fei
Fei on 12 Mar 2017
Is there anyway to remove a dataset instead of overwriting it? h5create('file.h5','/data/a',1); h5write('file.h5','/data/a',1000);
say I want to remove set /data/a, didn't find any api? Anyone pls give a hint, Thanks~

Products


Release

R2008b

Community Treasure Hunt

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

Start Hunting!

Translated by