Stateflow User's Guide Previous page   Next Page

Checking Embedded MATLAB Functions for Syntax Errors

Before you can build a simulation application for a model, you need to fix any possible syntax or grammar errors that keep the application from building. Use the following steps to check the Embedded MATLAB function stats for syntax and grammar errors that keep it from building:

  1. If not already open, open the call_stats_function model that you save at the end of Programming a Stateflow Embedded MATLAB Function, and open its Stateflow block and the Embedded MATLAB function stats inside.
  2. In the Embedded MATLAB Editor, select the Build tool
  1. If there are no errors or warnings, the Builder window appears and reports a message of success. If errors are found, the Builder window lists them. For example, if you change the call to the subfunction avg to a call to a nonexisting subfunction aug in stats, the following Builder window appears:

    Each detected error begins with a red button.

  1. Click the link in the diagnostic message to display the offending line highlighted in the Embedded MATLAB Editor, as shown.


Previous page  Debugging a Stateflow Embedded MATLAB Function Run-Time Debugging for Embedded MATLAB Functions Next page

© 1994-2005 The MathWorks, Inc.