setxor

Returns the elements exclusive to a or b.

Syntax

setxor(a,b)

setxor(a,b,'rows')

[c,ia,ib]=setxor(a,b)

Inputs

a,b
The sets of elements.
Type: double | integer | char | string | logical | struct | cell
Dimension: scalar | string | vector | matrix
'rows'
Find the set difference along the rows as opposed to the elements.
Type: double | integer | char | string | logical | struct | cell
Dimension: scalar | string | vector | matrix

Outputs

c
Elements exclusive to a or b in ascending order.
ia, ib
a(ia) and b(ib) are disjoint sets that compose c.

Examples

Simple setxor example:
setxor([1,5,2;6,2,6],[9;0;1;2])
ans = [Matrix] 4 x 1
0
5
6
9
Simple setxor example with 'rows' option:
setxor([1,5,2;6,2,6],[9 0 1],'rows')
ans = [Matrix] 3 x 3
1  5  2
6  2  6
9  0  1
Simple setxor example with multiple return:
[c,ia,ib]=setxor([1,5,2;6,2,6],[9;0;1;2])
c = [Matrix] 4 x 1
0
5
6
9
ia = [Matrix] 2 x 1
3
6
ib = [Matrix] 2 x 1
2
1