unionsa

Purpose

Returns the union of two string vectors with duplicates removed.

Format

y = unionsa(sv1, sv2)
Parameters:
  • sv1 (Nx1 or 1xN string vector) – data
  • sv2 (Mx1 or 1xM string vector) – data
Returns:

y (Lx1 vector) – contains all unique values that are in sv1 and sv2, sorted in ascending order.

Examples

// Strings for union
string sv1 = { "mary", "jane", "linda", "john" };
string sv2 = { "mary", "sally" };

// Find union of sv1 and sv2
y = unionsa(sv1, sv2);
print y;

The above code produces the following output:

jane
 john
linda
 mary
sally

Source

unionsa.src

See also

Functions union()