%% Summary Statistics
% Compute summary statistics on table variables.
% Create a table T that contains information about five individuals.

Gender = ["male";"female";"female";"male";"male"];
Age = [38;43;38;40;49];
Height = [71;69;64;67;64];
Weight = [176;163;131;133;119];
T = table(Gender,Age,Height,Weight)

% Compute the counts of males and females by specifying Gender as the grouping variable.

G = groupsummary(T,"Gender")

% Compute the mean age, height, and weight of females and males separately.

G = groupsummary(T,"Gender","mean")

% Still grouping by gender, compute the median height only.

G = groupsummary(T,"Gender","median","Height")

% Copyright 2012 The MathWorks, Inc.