Main Content

Custom Code

Include custom code for simulation and code generation

By incorporating custom code written in C or C++, augment the capabilities of your Stateflow® chart and take advantage of your preexisting code.

Topics

Reusable Functions in Charts

Specify function calls in states and transitions.

Reuse Custom Code in Stateflow Charts

Integrate preexisting custom code into Simulink® models.

Access Custom Code Variables and Functions in Stateflow Charts

Call custom code functions from your Stateflow charts.

Specify Relative Paths to Your Custom Code

Define relative folder paths for custom code integration.

Model Battery Management with Custom Code

Use custom code to design a system for battery management.

Featured Examples