eval
Execute a string as MathJet code.
Syntax
Section titled “Syntax”eval(str)[a1, a2, ...] = eval(str)Description
Section titled “Description”Parses and evaluates str as MathJet code in the caller’s workspace. The string can contain any expression or statement. Variables created by eval persist in the caller’s scope.
Use sparingly: eval defeats compile-time checks and is a common source of subtle bugs. Most uses can be replaced with structures, function handles, or dynamic field access (s.(fieldname)).
Examples
Section titled “Examples”eval('x = 1 + 2;') % x is now 3 in the callereval('sqrt(16)') % 4