Syntax: |
numeric = EVALUATE(string)
|
String variables can be used in numeric expressions, as so called expression variables, to shorten or to simplify an expression. Parentheses around the expression variable are assumed during numeric evaluation. For example:
T='A+B'
Y=X*T ! this is equivalent to Y=X*(A+B)
A string variable will be numerically evaluated if it is a numeric operand or the argument of
a numeric function. Otherwise, a string variable is treated as a string. Use the
EVALUATE
function to force numeric evaluation. The type of
result, that is, scalar, vector, or matrix, depends on the evaluated expression. The string
argument will not be modified.
Examples
Suppose that string variable T='3+2'
.
input | result |
=T |
the string '3+2' |
=EVALUATE(T) |
the numeric value 5 |