Siddharth Sharma, MathWorks
Design and simulate state charts using Stateflow®.
Stateflow provides a design environment for developing state diagrams and flow charts.
Stateflow is useful for applications involving logic, including task scheduling, fault management, and mode logic.
You create a Stateflow diagram by dragging states, junctions, and functions from a graphical palette into the design environment. States are connected to one another with transitions, which can contain conditions. This lets you quickly build state machines like the one shown here for a ball tracker. The tracker switches from the
Ball_Not_Found to the
Ball_Found state when the position of the ball, x, is greater than 0.
During simulation, you can visualize and understand the behavior of the logic by watching the animation of active states and transitions. For example, the blue highlighting shows how and when the tracker switches from one state to another.
Function types can be mixed and matched, enabling you to represent your logic in the most intuitive manner possible. You can represent your functions with: MATLAB®, Simulink®, flow charts, and truth tables.
By leveraging other products within the Simulink product family, you can test your logic and do coverage analysis to verify your designs early.
You can also generate C, C++, HDL, and PLC code from Stateflow. Here we can quickly trace the lines of code that you generated from this transition. We can also trace specific lines of code back to the model.
For more information on Stateflow, return to the product page or choose a link below.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .Select web site
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.