Modified output_table to be created from cell array using cell2table() instead of array2table(). This extracts the contents of each cell, facilitating later column based filtering ops.

This commit is contained in:
florez_j committed 2023-08-18 14:24:47 +02:00
1 parent 596a35f7f1
commit ac7f34a30a
1 file changed
+11 -4
+11 -4
View File
@@ -58,9 +58,9 @@ end
% Construct cell array with table data, where each row denotes a group, and
% the columns are either datasets or attributes in the given group.
tmp = {};
tmp = cell(num_rows,num_cols); % {};
idx = [];
group_columns = {};
group_columns = {};
for i = 1 : num_rows
disp(['Begin construction of row:',INFO.Groups(i).Name])
@@ -86,7 +86,7 @@ for i = 1 : num_rows
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
@@ -115,5 +115,12 @@ end
[~, idx_perm] = sort(idx,'ascend');
varNames = [dataset_columns,group_columns];
output_table = array2table(tmp(:,idx_perm), 'VariableNames', varNames(idx_perm));
% Create output_table from cell array using cell2table. This as opposed to
% array2table extract the content of its cells, which facilitates filtering
% operations based on table columns/vars.
%output_table = array2table(tmp(:,idx_perm), 'VariableNames', varNames(idx_perm));
output_table = cell2table(tmp(:,idx_perm), 'VariableNames', varNames(idx_perm));