Stateflow
Product Description
- Introduction and Key Features
- Working with Stateflow
- Creating State Charts
- Adding Functions to State Charts
- Executing State Charts
Executing State Charts
After modeling your logic in Stateflow, you can simulate and view its behavior live to test and validate your design. A graphical debugger helps you resolve simulation run-time errors and diagnose unexpected behavior in your design.
Visualizing Results
During simulation, you can visualize the Stateflow chart by:
- Highlighting the active states and the transition paths taken
- Viewing states and data with the displays and scopes provided in Simulink
- Building your own custom displays using MATLAB visualization and graphical user interface development tools
After simulation, you can log states and data for postprocessing.
Floating scope (left) from Simulink for viewing state transitions as the simulation runs. Specific states can be selected using the Signal Selector (right) within Simulink.
Debugging a Simulation
The Stateflow debugger lets you set breakpoints, control the simulation execution, and display model information. It can be run from a graphical user interface (GUI) or from the MATLAB command line. The GUI provides clear information about the chart's execution status. You can display information on breakpoints, current data values, active states, and the call stack.
Run-time errors can also be detected with the debugger. These include state inconsistencies, transition conflicts, data range violations, potential infinite loops, and ill-specified truth tables.
Stateflow debugger, which can set breakpoints, start and stop simulations, evaluate run-time errors, and perform dynamic error checking.
Validating Your Design
You can map requirements directly to Stateflow objects and collect model coverage metrics using Simulink® Verification and Validation (available separately).
Generating Code
Stateflow charts can be deployed to many applications using Simulink Coder (available separately).

Free Stateflow Interactive Kit
Learn how engineers use Stateflow to model state machines in their Simulink models.
Get free kit

