MATLAB: Remove values of a matrix from another

errormatrixnumbersremove

Hi,
I have 2 matrices that are just lists of numbers. Matrix "A" is 380×1 and Matrix "B" is 230×1. I am trying to remove all of the numbers that are in "B" from "A". All of the numbers that are in B are in A so that should not be a problem. I have been trying to use
A(B)=[];
That is giving me the error "Index of element to remove exceeds matrix dimensions." I don't understand this since B is smaller than A.
Are there any other ways to do this?
Thanks in advance.

Best Answer

A = A(~ismember(A,B))