%% Filter Two-Variable Table
% Create a table containing two variables.

groupID = [1 1 1 2 2 3]';
sample = [3 1 2 9 8 5]';
T = table(groupID,sample)

% Group by ID number, and return only rows corresponding to groups with more than two samples.

Gnumel = groupfilter(T,'groupID',@(x) numel(x) > 2)

% Return only rows whose group samples are between 0 and 6.

Gvals = groupfilter(T,'groupID',@(x) min(x) > 0 && max(x) < 6)

% Copyright 2019 The MathWorks, Inc.