MATLAB: Delete Rows of an Array where a given column is less (or greater) than a given value

MATLABmatrixsortrows

Hello!
With an array like this:
A= 4 2 3
1 6 5
1 2 9
5 2 2
1 2 6
I would like to have an array with (for example) column 3 less than 5. I know that sortrows(A,3) can get the rows in order, but what is the (logical?) test to eliminate these rows?
Thanks!
Doug

Best Answer

To eliminate the rows with the value of column 3 less than 5, keep those with the value of column 3 greater than or equal to 5:
A = A(A(:,3) >= 5, :)
similarly:
A(A(:,3) < 5, :) = []
will both produce:
A =
1 6 5
1 2 9
1 2 6
Is this what you want to do?