%% Symmetric Difference of Two Vectors and Indices to Different Values
% Define two vectors with a value in common.

A = [5 1 3 3 3]; B = [4 1 2];

%
% Find the values of A and B that are not in their intersection as well as the index vectors ia and ib.

[C,ia,ib] = setxor(A,B)

% C is a sorted combination of the elements A(ia) and B(ib).
% Copyright 2012 The MathWorks, Inc.