The way to delete elements of an array that fulfill a given condition such as greater than is with:
So in your case:
Note that with a matrix, it will flatten it into a column vector, as there's no guarantee it deletes enough element to keep the same number of columns (or rows, or whatever dimension you want to stay the same).
For example, what matrix would you want if you started with
A = [1 2 9; 3 1 4; 2 2 7];
If you know that the number of elements deleted is always going to produce a valid rectangular matrix with the same number of columns as you started with, the following would work:
ncol = size(A, 2);
A(A > 4) = [];
A = reshape(A, [], ncol);
Best Answer