In MATLAB, the transition from hdf5write to h5write and h5writeatt indeed comes with some changes in how data types are handled, particularly with attributes. The h5writeatt function does not directly support cell arrays as attribute data types, which is why getting an error. However, we can work around this by converting the cell array into a format that is supported, such as a character array.
Below is the sample MATLAB code to achieve the same:
% Create the dataset
dset = rand(10,3);
h5create('myfile.h5', '/group', size(dset));
h5write('myfile.h5', '/group', dset);
% Convert the cell array to a character array
attr = {'Time', 'Var1', 'Var2'};
attr_str = strjoin(attr, ', '); % Join with a delimiter, e.g., comma and space
% Write the attribute as a character array
h5writeatt('myfile.h5', '/group', 'ColumnHeaders', attr_str);
Please find attached the documentation of functions used for reference:
I hope this helps in resolving the issue.
