%% Table Rows
% For a table that describes patient information for five people, determine how the rows of the table are sorted.
% Create a table with four variables, and determine if the rows of the table are in ascending order based on age.  Since the age variable contains a repeated element, issortedrows then checks the next column (Height) to break the tie.

LastName = {'Sweet';'Jacobson';'Wang';'Joiner';'Berger'};
Age = [38;38;40;43;49];
Height = [69;71;64;67;64];
Weight = [176;163;131;133;119];
BloodPressure = [124 93; 109 77; 125 83; 117 75; 122 80];

tblA = table(Age,Height,Weight,BloodPressure,'RowNames',LastName)

TF = issortedrows(tblA)

% Check if the table rows are sorted by last name, which are the row names for tblA.

TF = issortedrows(tblA,'RowNames')

% Check if the table rows are in ascending order by age, then in descending order by weight.

TF = issortedrows(tblA,{'Age','Weight'},{'ascend','descend'})

% Copyright 2012 The MathWorks, Inc.