union - extract union components of a vector
union(a,b) returns a sorted row vector which retains the unique entries of [a(:);b(:)].
[v,ka,kb]=union(a,b) also returns index vectors ka and kb such that v is a sorted combination of the entries a(ka) and b(kb).
A=round(5*rand(10,1)); B=round(5*rand(7,1)); union(A,B) [N,ka,kb]=union(A,B) union('a'+string(A),'b'+string(B))