Documentation

Evaluate MATLAB Expression

Evaluate specified MATLAB expression

Description

This component evaluates a specified MATLAB® expression. You can include code and/or command-line output in the report.

Properties

  • Insert MATLAB expression in report: Causes the MATLAB expression that this component evaluates to appear in the report.

  • Display command window output in report: Includes the command window output that results from the evaluation of the specified MATLAB expression.

  • Expression to evaluate in the base workspace: Specifies the expression to evaluate in the MATLAB workspace. .

    If you are using Simulink® Report Generator™, then you can use functions such as Rptgen.getReportedBlock to filter the modeling elements on which to report and to perform special reporting on specific elements. For more information, in the Simulink Report Generator documentation, see Loop Context Functions.

  • Evaluate this expression if there is an error: Evaluates another MATLAB expression if the specified expression produces an error. You must enter in this field the expression to evaluate in case of an error.

    If you do not change the default error handling code, then when you generate the report, and there is an error in the MATLAB code that you added:

    • If you clear Evaluate this expression if there is an error check box, then the complete report is generated, without displaying an error message at the MATLAB command line.

    • If you select Evaluate this expression if there is an error check box, then the complete report is generated and an error message appears at the MATLAB command line.

    To stop report generation when an error occurs in the MATLAB code that you added, change the second and third lines of the following default error handling code, as described below:

    warningMessageLevel = 2;
    displayWarningMessage = true;
    failGenerationWithException = false;
    failGenerationWithoutException = false;

    To stop report generation and display an exception, change the default code to:

    displayWarningMessage = false;
    failGenerationWithException = true;

    To stop report generation without displaying an exception, change the default code to:

    displayWarningMessage = false;
    failGenerationWithoutException = true;

    If you want to completely replace the default error handling code, use the evalException.message variable in your code to return information for the exception.

Insert Anything into Report?

Inserts text only if you select one of the following options:

  • Insert MATLAB expression string in report

  • Display command window output in report

Class

rptgen.cml_eval

Was this topic helpful?