%% Write Data to Unlimited Dataset
% Write data to a dataset that has an unlimited dimension.
% Create a dataset that is unlimited along the second dimension. ChunkSize must be specified to set any dimension of the dataset to Inf.

h5create('myfile.h5','/g2/DS2',[20 Inf],"Chunksize",[5 5]);

% Write a 3-by-3 block of data to '/g2/DS2'. Begin at the starting point [3 2] and write to the end of the block. You can write data of any size along the second dimension of the dataset, since it is unlimited.

data = rand(3);
start = [3 2];
count = [3 3];
h5write('myfile.h5','/g2/DS2',data,start,count);

% Read all of the data from the dataset.

h5read('myfile.h5','/g2/DS2')

% Copyright 2015 The MathWorks, Inc.