next up previous contents
Next: SOURCE Execute an Arbitrary Up: FreeMat Functions Previous: SLEEP Sleep For Specified   Contents

Subsections

EVAL Evaluate a String

Usage

The eval function evaluates a string. The general syntax for its use is

   eval(s)

where s is the string to evaluate.

Example

Here are some examples of eval being used.

--> eval('a = 32')
a = 
  <int32>  - size: [1 1]
            32  
ans = 
  <double>  - size: []
  []

The primary use of the eval statement is to enable construction of expressions at run time.

--> s = ['b = a' ' + 2']
s = 
  <string>  - size: [1 9]
 b = a + 2
--> eval(s)
b = 
  <int32>  - size: [1 1]
            34  
ans = 
  <double>  - size: []
  []



Samit K. Basu 2005-03-16