forked from episodes-platform/shared-snippets
23 lines
1004 B
Mathematica
23 lines
1004 B
Mathematica
|
% -----------------
|
||
|
% Copyright © 2023 ACK Cyfronet AGH, Poland.
|
||
|
% -----------------
|
||
|
function [columnsInTimeGroup, columnsNotToInclude] = getTimeGroups(column_desc)
|
||
|
% DESCRIPTION: Script iterating through column_desc and returning column indexes grouped by the same
|
||
|
% inputTimeGroup. The second output is array of all the other columns indexes than first in their own respective time group
|
||
|
% INPUTS:
|
||
|
% - column_desc : structure containing definition of the CSV columns and their mapping to the final object
|
||
|
columnsInTimeGroup = containers.Map();
|
||
|
columnsNotToInclude = [];
|
||
|
|
||
|
for i=1:length(column_desc)
|
||
|
inputTimeGroup = column_desc(i).inputTimeGroup;
|
||
|
if ~isempty(inputTimeGroup)
|
||
|
if ~ismember(inputTimeGroup, columnsInTimeGroup.keys)
|
||
|
columnsInTimeGroup(inputTimeGroup) = [i];
|
||
|
else
|
||
|
columnsInTimeGroup(inputTimeGroup) = cat(1, columnsInTimeGroup(inputTimeGroup), i);
|
||
|
columnsNotToInclude = cat(1, columnsNotToInclude, i);
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|