setxor
Returns the elements contained in either of two sets, but not in their intersection.
Syntax
setxor(a,b)
setxor(a,b,'sorted')
setxor(a,b,'stable')
setxor(a,b,'rows')
[c,ia,ib]=setxor(a,b)
Inputs
- a, b
 - The sets whose exclusive union is to be formed.
 - 'sorted'
 - Returns elements of the exclusive union in ascending order.
 - 'stable'
 - Returns elements of the exclusive union in their original order.
 - 'rows'
 - Returns distinct rows as opposed to distinct elements.
 
Outputs
- c
 - The exclusive union of a and b.
 - ia, ib
 - a(ia) and b(ib) are disjoint sets whose union is c.
 
Examples
setxor([1,5,2;6,2,6],[9;0;1;2])ans = [Matrix] 4 x 1
0
5
6
9setxor([1,5,2;6,2,6],[9 0 1],'rows')ans = [Matrix] 3 x 3
1  5  2
6  2  6
9  0  1[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
1Comments
When repeated elements occur in an input, the last index will be used.