Log Simulation Ranges for MATLAB Function Block

This example shows how to log simulation minimum and maximum values for a MATLAB Function block and view these values in the MATLAB® Function Report.

  1. Open the ex_matlab_function_block_logging model. At the MATLAB command line, enter:

    addpath(fullfile(docroot,'toolbox','fixpoint','examples'))
    ex_matlab_function_block_logging

  2. From the model Analysis menu, select Fixed-Point Tool.

  3. In the Fixed-Point Tool, under Settings for selected system, Fixed-point instrumentation mode is set to Minimums, maximums and overflows so that the Fixed-Point Tool logs the simulation minimum and maximum values. Data type override is set to Use local settings so that the Fixed-Point Tool logs data using the data types specified in the model.

  4. On the Fixed-Point Tool Model Hierarchy pane, select ex_matlab_function_block_logging.

  5. Click the Simulate button, .

    The Simulink® software simulates the model using the specified fixed-point instrumentation and local data type settings.

  6. In the ex_matlab_function_block_logging model, double-click the MATLAB Function block.

    The MATLAB Function block code is displayed in the MATLAB editor window.

  7. In MATLAB, on the Editor tab, click View Report.

  8. In the MATLAB Function Report, click the Variables tab.

    The Variables tab displays the simulation minimum and maximum values for the MATLAB Function block input, output, and variables.

Was this topic helpful?