Main Content

symvar

Determine symbolic variables in expression

Description

example

C = symvar(expr) searches the expression, expr, for identifiers other than i, j, pi, inf, nan, eps, and common functions. These identifiers are the names of variables in the expression. symvar returns the identifiers in a cell array of character vectors, C. If symvar finds no identifiers, then C is an empty cell array.

Examples

collapse all

Create a character vector that contains an expression. Find the identifiers in the expression and return them in a cell array.

C = symvar('cos(pi*x - beta1)')
C = 2x1 cell
    {'beta1'}
    {'x'    }

Input Arguments

collapse all

Input expression, specified as a character vector or string scalar.

Algorithms

  • The common functions and constants that the symvar function ignores are:

    • eps

    • i

    • inf

    • Inf

    • j

    • nan

    • NaN

    • pi

Version History

Introduced before R2006a

See Also

| |