| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Stateflow |
| Contents | Index |
| Learn more about Stateflow |
| On this page… |
|---|
You can generate code for models with Stateflow charts and Truth Table blocks for these uses:
Simulation
Production and rapid prototyping
A simulation target is a specification of the generated code, custom code, and build type you use for generating simulation code for Chart and Truth Table blocks in a model.
Whenever you simulate a model that contains Stateflow blocks, Stateflow software generates code that compiles into an S-function MEX file (for details, see S-Function MEX-Files). This code enables the Stateflow blocks to interface with other blocks in a Simulink model, the MATLAB base workspace, and the Stateflow Debugger. This code is not suitable for production or rapid prototyping.
An embeddable target is a specification of the generated code, custom code, and build type you use for generating production code for Chart and Truth Table blocks in a model.
Stateflow Coder and Real-Time Workshop software can work together to generate embeddable code for Stateflow blocks. This code is optimized for production and rapid prototyping, but does not contain code to interface with other blocks in a Simulink model, the MATLAB base workspace, and the Stateflow Debugger.
To build targets for models with Stateflow charts or Truth Table blocks, you must have a license for the software listed:
| Target to Build | Software to Use |
|---|---|
| Simulation target | Stateflow |
| Embeddable target | Stateflow Coder and Real-Time Workshop |
The default target type of Real-Time Workshop code generation is generic real-time (grt). To build other embeddable targets, you must have the appropriate license. See Available Targets in the Real-Time Workshop User's Guide for more information.
![]() | Building Targets | Choosing a Procedure to Simulate a Model | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |