Stateflow    

Integrating Custom and Generated Code

The MATLAB Digest article, "Integrating Custom C-Code Using Stateflow 2.0," explains in detail how to integrate code that you write with code generated by Stateflow. This article is available at http://www.mathworks.com/company/digest/june99/stateflow/.

This section provides additional information on integrating code that you create with code generated by Stateflow from a Stateflow model.

Invoking Graphical Functions

To call a graphical function from your custom code:

  1. Create the graphical function at the root level of the chart that defines the function (see Creating a Graphical Function).
  2. Export the function from the chart that defines the function (see Exporting Graphical Functions).

    This option implicitly forces the chart and function names to be preserved.

  1. Include the generated header file chart_name.h at the top of your custom code, where chart_name is the name of the chart that contains the graphical function.

    The chart header file contains the prototypes for the graphical functions that the chart defines.


 Compilation Error Messages Debugging