%% Matrix Rows
% Create a matrix and determine if its rows are in ascending order based on the values in the first column.  Since the first column has a repeated element, sortrows looks to the second column to determine whether the matrix rows are sorted.

A = [1 2 9; 1 5 8; 4 0 7]
TF = issortedrows(A)

% Determine if the rows of A are in ascending order based on the values in the third column.

TF = issortedrows(A,3)

% Determine if the rows of A are in descending order based on the values in the third column.

TF = issortedrows(A,3,'descend')

% Copyright 2012 The MathWorks, Inc.