MATLAB: Deleting selective multiple rows from a data matrix

MATLABmatrixremove

I want to delete rows of a matrix depending on some specific values of one of its columns. Say, if A=[1,2,3,1;5,6,7,2;9,10,11,3;13,14,15,4]; B=A(:,4);
I want to delete rows of A if B<2 and B>3, that is want the second and third rows of A.
I have tried A(B,:)=[] type commands, but failed.

Best Answer

A(~(B<2|B>3),:)