MATLAB: Deleting values from an array

array manipulationseliminating elements

I have an array R3. I need to eliminate those elements of R3 which are present in another, smaller array. Is there an easy method to do this?

Best Answer

setdiff replies all elements of a vector, which do not appear in a second one:
R3 = setdiff(R3, smallerArray);
Or
R3 = R3(~ismember(R3, smallerArray))