Method on @sym: unique (A)

Return the unique elements of a symbolic matrix.

Example:

syms x
A = [sym(1) 2 pi x x pi 2*sym(pi)];
unique(A)
  ⇒ ans = (sym) [1  2  π  x  2⋅π]  (1×5 matrix)

Note the output will be a matrix. If instead you want a set, try:

finiteset(num2cell(A))
  ⇒ ans = (sym) {1, 2, π, 2⋅π, x}

See also: @sym/union, @sym/intersect, @sym/setdiff, @sym/setxor, @sym/ismember, @sym/finiteset.

Package: symbolic