h5create creates Extendable (unlimited) dataset also if Size == 0
Show older comments
According to the h5create() documentation, you can create a dataset with unlimited dimension(s) by specifying Inf for any of the Size dimensions.
However, when creating (for a test case) an empty dataset with Size == 0, I found that that is also an indication for an Extendable dataset. I got the error message that I had forgotten to specify the ChunkSize, as required for extendable datasets. This undocumented feature can be read on line 177 of h5create.m:
% Setup Extendable.
options.Extendable = false(1,numel(options.Size));
options.Extendable(isinf(options.Size)) = true;
options.Extendable(options.Size == 0) = true; % <- line 177
It is not strange to handle the Size == 0 case as indicator that (more) data will follow later (thus requiring extendability and a ChunkSize). If that is the intended behaviour, please update the documentation likewise.
An alternative approach could be that if Size == 0 the presence of ChunkSize determines if the dataset will be extendable. That will require an update of h5create as well, and might break existing code, relying on the current exception behaviour.
1 Comment
Abhipsa
on 6 Jun 2025
I have also observed this behavior when using h5create with Size == 0, MATLAB throws an error unless ChunkSize is explicitly specified.
Accepted Answer
More Answers (0)
Categories
Find more on Environment and Settings 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!