This example shows how custom C++ files can be used in a Stateflow® model.
You can integrate C++ code into a model by using Stateflow. These steps illustrate the workflow:
Create a C-style wrapper function or create access macros for each method called within the C chart.
Open the Model Configuration Parameters dialog box. In the Simulation Target pane, add the custom header file, source files, and any include directories.
In the Code Generation > Custom Code pane, enter the same information.
Open the Model Configuration Parameters dialog box. In the Code Generation pane, change the Language setting to C++
.