Stateflow User's Guide Previous page   Next Page

Configuring a Custom Target in Stateflow

A Stateflow custom target (named anything but sfun or rtw) is a convenience for collecting the generated code for the Stateflow charts in a model. After you collect the code, you can use this code at your own discretion in building your own applications. You configure a custom target in the Model Explorer with the following procedure:

  1. From the Stateflow diagram editor toolbar, select Explore .
  2. The Model Explorer appears with the Stateflow chart highlighted in the Model Hierarchy pane.

  3. In the Model Explorer, in the left Model Hierarchy pane, select the Simulink model with the custom target.

  1. The custom target (in this example, ctarg) appears as a child of the Simulink model. Custom targets have names other than sfun or rtw.

    If you need to create a custom target in the Model Explorer, see Adding a Target in the Model Explorer.

  1. In the Contents pane, click the row for the custom target ctarg.
  1. The Stateflow Target Builder dialog appears in the dynamic dialog on the right, as shown.

  1. In the Stateflow Target Builder dynamic dialog, in the long field below the Target Language descriptor, select one of the following build options:
  2. To specify code generation options for a custom target, select the Coder Options.
  1. The Coder Options dialog box for the custom target appears as follows:

  1. Select any or all of the following options:
  1. The following options are unique to custom targets:

    The following options are also available for RTW targets. See Configuring Real-Time Workshop for Stateflow for a description.

Custom code options are selected through the Target Options button. To specify custom code options for your rtw target, see Integrating Custom Code with Stateflow Targets.

  1. Select (check) the Use settings for all libraries option if you want the settings that you specify for this target to apply to all the Stateflow charts contributed by library models as well, s.
  2. To specify custom code options for the simulation target, select Target Options.
  1. See Integrating Custom Code with Stateflow Targets for details on using the custom target to integrate custom code with generated code for the Stateflow diagrams in the model.

  1. To finish configuring the custom target, do one of the following:

Previous page  Configuring the Stateflow Blocks in Library Models for Real-Time Workshop Integrating Custom Code with Stateflow Targets Next page

© 1994-2005 The MathWorks, Inc.