This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the 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 that contains a valid MATLAB® expression.

To include a numeric value in the expression, convert it to a character vector with int2str, num2str, or sprintf.

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.

More About

collapse all


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

See Also

| | | | | |

Introduced before R2006a

Was this topic helpful?