This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Evaluate MuPAD expressions without specifying their arguments


result = evalin(symengine,MuPAD_expression)
[result,status] = evalin(symengine,MuPAD_expression)


result = evalin(symengine,MuPAD_expression) evaluates the MuPAD® expression MuPAD_expression, and returns result as a symbolic object. If MuPAD_expression throws an error in MuPAD, then this syntax throws an error in MATLAB®.

[result,status] = evalin(symengine,MuPAD_expression) lets you catch errors thrown by MuPAD. This syntax returns the error status in status and the error message in result if status is nonzero. If status is 0, result is a symbolic object; otherwise, it is a character vector.

Input Arguments


Character vector containing a MuPAD expression.

Output Arguments


Symbolic object or character vector containing a MuPAD error message.


Integer indicating the error status. If MuPAD_expression executes without errors, the error status is 0.


Compute the discriminant of the following polynomial:

ans =
 b^2 - 4*a*c

Try using polylib::discrim to compute the discriminant of the following nonpolynomial expression:

[result, status] = evalin(symengine,'polylib::discrim(a*x^2+b*x+c*ln(x),x)')
result =
    'Arithmetical expression expected.'

status =


  • Results returned by evalin can differ from the results that you get using a MuPAD notebook directly. The reason is that evalin sets a lower level of evaluation to achieve better performance.

  • evalin does not open a MuPAD notebook, and therefore, you cannot use this function to access MuPAD graphics capabilities.


feval lets you evaluate MuPAD expressions with arguments. When using feval, you must explicitly specify the arguments of the MuPAD expression.

Introduced in R2008b

Was this topic helpful?