MATLAB Function Reference Previous page   Next Page
eval

Execute string containing MATLAB expression

Syntax

Description

eval(expression) executes expression, a string containing any valid MATLAB expression. You can construct expression by concatenating substrings and variables inside square brackets:

[a1, a2, a3, ...] = eval(function(b1, b2, b3, ...)) executes function with arguments b1, b2, b3, ..., and returns the results in the specified output variables.

Remarks

Using the eval output argument list is recommended over including the output arguments in the expression string. The first syntax below avoids strict checking by the MATLAB parser and can produce untrapped errors and other unexpected behavior.

Examples

This for loop generates a sequence of 12 matrices named M1 through M12:

The next example executes the size function on a 3-dimensional array, returning the array dimensions in output variables d1, d2, and d3.

See Also

assignin, catch, evalin, feval, lasterr, try


Previous page  etreeplot evalc Next page

© 1994-2005 The MathWorks, Inc.