diff --git a/import/read_hdf5_as_table.m b/import/read_hdf5_as_table.m index cd60605..12af873 100644 --- a/import/read_hdf5_as_table.m +++ b/import/read_hdf5_as_table.m @@ -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)