MATLAB: Deleting rows of matrix from the rows of other matrix with different dimension

compare matrixdelete rowsdifferent dimensionMATLAB

I want to remove rows of my main matrix from the condition of the rows of other matrix. Lets say I have this data
A = [1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
5 6 7 8 9];
B = [1 2
3 4];
I want to delete some rows of matrix A so it would be like this
A = [2 3 4 5 6
5 6 7 8 9];
Can anyone help me with this

Best Answer

The simplest solution is to use ismember with its 'rows' option:
idx = ismember(A(:,1:2),B,'rows');
A(idx,:) = []