Modified read_hdf5_as_table.m to read String entries as chars.

This commit is contained in:
florez_j committed 2023-08-18 11:47:20 +02:00
1 parent c23464c795
commit 596a35f7f1
1 file changed
+11 -1
+11 -1
View File
@@ -77,7 +77,17 @@ for i = 1 : num_rows
end
if j > num_attr1
Name = INFO.Groups(i).Attributes(j-num_attr1).Name;
tmp{i,j} = h5readatt(filename,INFO.Groups(i).Name, Name);
Datatype = INFO.Groups(i).Attributes(j-num_attr1).Datatype.Class;
% Detect string attributes and convert them to characters.
% TODO: extend to other necessary data types.
if strcmp(Datatype,'H5T_STRING')
convert_func = @(x) convertStringsToChars(x);
else % no data type conversion is performed
convert_func = @(x) x;
end
tmp{i,j} = convert_func(h5readatt(filename,INFO.Groups(i).Name, Name));
if i < 2
disp(Name)