MATLAB: How to filter the rows i donot want in a matrix

compering rowsmatlab matrix filter

there is a matrix like
A=[ 0 1 0;
0 2 0;
1 0 0;
1 0 1];
compering A(1,:) and A(2,:), i choose [0 2 0];compering A(3,:) and A(4,:), i choose [1 0 1].
the final matrix i want is
A=[ 0 2 0;
1 0 1];
This is just a simple example, if the matrix is M*N, how to use matlab code to get the matrix i want.

Best Answer

Edit
A=[1 1 0;0 2 0;1 0 0;1 0 1]
n=size(A,1);
k=1;
while k<n
if any(all(bsxfun(@le,A(k,:),A(k+1:end,:)),2))
A(k,:)=[];
k=k-1;
end
k=k+1;
n=size(A,1);
end
A