%% Sort Rows of Table by Row Names
% Create a table with four variables listing patient information for five people.

LastName = {'Smith';'Johnson';'Williams';'Jones';'Brown'};
Age = [38;43;38;40;49];
Height = [71;69;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)

%
% Sort the rows of the table in ascending order based on the row names, and return the index vector that describes how the rows were rearranged.

[tblB,index] = sortrows(tblA,'RowNames')

% Copyright 2012 The MathWorks, Inc.