diff --git a/import/read_hdf5_as_table.m b/import/read_hdf5_as_table.m index e38f6b1..e2c622f 100644 --- a/import/read_hdf5_as_table.m +++ b/import/read_hdf5_as_table.m @@ -14,23 +14,27 @@ if ~iscellstr(exclude_var_set) end INFO = h5info(filename); - num_rows = length(INFO.Groups); + num_attr1 = length(INFO.Groups(1).Datasets); num_attr2 = length(INFO.Groups(1).Attributes); num_cols = num_attr1 + num_attr2; sz = [num_rows,num_cols]; % Extract group level attributes, they align for all -% groups/measurements/rows of the table in filename .h5 +% groups (here denoting measurements/or rows) of the table in filename .h5 group_columns = {INFO.Groups(1).Attributes.Name}; -dataset_columns = {}; -for j = 1 : num_attr1 - dataset_columns{j} = INFO.Groups(1).Datasets(j).Attributes.Value; +if num_attr1 == 1 && isempty(INFO.Groups(1).Datasets(num_attr1).Attributes) + dataset_columns = {}; + num_attr1 = 0; + num_cols = num_cols - 1; +else + for j = 1 : num_attr1 + dataset_columns{j} = INFO.Groups(1).Datasets(j).Attributes.Value; + end end - %TODO: Implement feature to exclude varibales/columns as well as rows at %reading time. This requires propagating modifications % % % Select group and dataset columns to be loaded from hdf5 file, which are