deleting values from an array

2 views (last 30 days)
SSG_newbiecoder
SSG_newbiecoder on 4 Jan 2018
Edited: Stephen23 on 4 Jan 2018
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 Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!