This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Evaluate MATLAB expression with capture


T = evalc(expression)
[T,output1,...,outputN] = evalc(expression)


T = evalc(expression) is the same as eval(expression) except that anything that would normally be written to the command window, except for error messages, is captured and returned in the character array T (lines in T are separated by \n characters).

[T,output1,...,outputN] = evalc(expression) is the same as [output1,...,outputN] = eval(expression) except that any output is captured into T.

Input Arguments


Character vector or string scalar that contains a valid MATLAB® expression.

To include a numeric value in the expression, convert it to a character vector or string scalar.

Output Arguments


Output normally written to the command window during the evaluation of expression, except for error messages, returned in a character array. The lines in T are separated by \n characters.


Outputs from the evaluated expression.


When you are using evalc, functions diary, more, and input are disabled.

See Also

| | | | | |

Introduced before R2006a

Was this topic helpful?