Using Simulink Previous page   Next Page

Checking the Function for Errors

Once you finish specifying an Embedded MATLAB Function block in its Simulink model, use the built-in diagnostics of Embedded MATLAB Function blocks to test for syntax errors with the following procedure:

  1. If not already open, open the call_stats_block2 model that you save at the end of Programming the Embedded MATLAB Function, and double-click its Embedded MATLAB Function block stats to open it for editing.
  2. In the Embedded MATLAB Editor, click the Build tool to compile and build the example Simulink model.
  1. If errors are found, the Builder window lists them. Otherwise, nothing happens.

  1. For example, change the call to the subfunction avg to a call to a fictitious subfunction aug and then compile to see the following result.

  1. Each detected error begins with a red button. In this case, rows 2, 4, 5, and 6 have a red button.

  1. Click the first error line to highlight it and display information for it.

  2. In the diagnostic message for the error appearing in the bottom pane of the Build window, click the link.
  1. The offending line appears highlighted in the Embedded MATLAB Editor.

  1. Correct the error and recompile.

Previous page  Programming the Embedded MATLAB Function Defining Inputs and Outputs Next page

© 1994-2005 The MathWorks, Inc.