Main Content

Code Generation of Stateflow Blocks

The code generator produces code for Stateflow® blocks for rapid prototyping. If you have an Embedded Coder® license, you can generate production code for Stateflow blocks.

Comparison of Code Generation Methods

The following sections compare two ways of generating code.

Code Generation Without Atomic Subcharts

You generate code for the entire model in one file and look through that entire file to find code for a specific part of the chart.

Code Generation With Atomic Subcharts

You specify code generation parameters so that code for an atomic subchart appears in a separate file. This method of code generation enables unit testing for a specific part of a chart. You can avoid searching through unrelated code and focus only on the part that interests you.


Unreachable Stateflow states are optimized out and are not included in the generated code.

Related Topics