Why does setdiff answer depend on order of arguments?
Show older comments
>>bob = {'a','b','c'};
>>bill = {'a','b','c', 'd','e'}
As expected,
>>A = setdiff(bill,bob)
A =
'd' 'e'
BUT
>> B = setdiff(bob,bill)
B =
Empty cell array: 1-by-0
WHY??
Accepted Answer
More Answers (2)
madhan ravi
on 9 Sep 2019
Edited: madhan ravi
on 9 Sep 2019
bob not in bill (nothing unique all elements of bob belong to bill)
help setdiff
1 Comment
Brian Wilson
on 10 Sep 2019
Walter Roberson
on 9 Sep 2019
0 votes
setdiff implements set subtraction A \ B which is not commutative
1 Comment
Brian Wilson
on 10 Sep 2019
Categories
Find more on Characters and Strings 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!