MATLAB: Delete rows from matrix according to another matrix

remove rows from matrix

A= 1 2 3; 4 5 6; 7 8 9; 1 3 4; 5 6 7
B= 5 6 7; 1 2 3
A and B are given,how to delete corresponding rows from matrix A according to matrix B? Try not to use loops. Thanks.

Best Answer

setdiff(A,B,'rows')