Illustration of Set operations:
For illustration, given the vectors as shown below:
>> v1 = 2:6
v1 =
2 3 4 5 6
>> v2 = 1:2:7
v2 =
1 3 5 7
The union function returns a vector which contains all the values from the two input argument vectors, without replicating any.
>> union(v1,v2)
ans =
1 2 3 4 5 6 7