MATLAB: Conditionally deleting matrix rows

Hi all,
I wish to delete matrix rows according to a condition imposed over its columns. let assume the matrix is of 10×2 (rows x columns) size.
A= [16 45; 79 8; 31 23; 53 91; 17 15; 60 83; 26 54; 65 100; 69 8; 75 44]
I want to delete the row if either A(i,1) or A(i,2) is larger than 50
A= [16 45; 31 23; 17 15]

Best Answer

Try this:
A= [16 45; 79 8; 31 23; 53 91; 17 15; 60 83; 26 54; 65 100; 69 8; 75 44]
rowsToDelete = any(A>50, 2)
A(rowsToDelete,:) = []