setdiff with reptitions ?

2 views (last 30 days)
daniel zayed
daniel zayed on 27 Nov 2018
Commented: Star Strider on 27 Nov 2018
i have two array A ,B i need to know all elements that inside A but not B including reptitons ,thx .

Accepted Answer

Star Strider
Star Strider on 27 Nov 2018
Edited: Star Strider on 27 Nov 2018
Experiment with the ismember (link) funciton or if you are using floating-point numbers, ismembertol (link):
A = randi(9, 1, 10)
B = randi(5, 1, 8)
L = ismember(A, B)
Out = A(L)
or:
Out = A(~L)
depending on the result you want.
  2 Comments
Star Strider
Star Strider on 27 Nov 2018
As always, my pleasure!

Sign in to comment.

More Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!