%% Write Attribute to Root Group
% Write an attribute to the root group of examplefile.h5 whose value is the current time.

date = datestr(now);
h5writeatt('examplefile.h5','/','creation_date', date);

% Read the attribute from the root group of the HDF5 file.

val1 = h5readatt('examplefile.h5','/','creation_date')

% Copyright 2019 The MathWorks, Inc.