Function: findsymbols (x)

Return a list (cell array) of the symbols in an expression.

The list is sorted alphabetically. For details, see ‘@sym/symvar’.

If two variables have the same symbol but different assumptions, they will both appear in the output. It is not well-defined in what order they appear.

x could be a sym, sym array, cell array, or struct.

syms x y z
C = {x, 2*x*y, [1 x; sin(z) pi]};
S = findsymbols (C)
  ⇒ S = { ... }
S{:}
  ⇒ ans = (sym) x
  ⇒ ans = (sym) y
  ⇒ ans = (sym) z

Note ℯ, ⅈ, π, etc are not considered as symbols.

Note only returns symbols actually appearing in the RHS of a symfun.

See also: symvar, @sym/symvar, @sym/findsym.

Package: symbolic