deleting values from an array

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?

1 Comment

Stephen23
Stephen23 on 4 Jan 2018
Edited: Stephen23 on 4 Jan 2018
"Is there an easy method to do this?"

Sign in to comment.

 Accepted Answer

Jan
Jan on 4 Jan 2018
Edited: Jan on 4 Jan 2018
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))

More Answers (0)

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Asked:

on 4 Jan 2018

Edited:

on 4 Jan 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!