| Stateflow User's Guide | ![]() |
Calling a Truth Table in a Stateflow Action
In Creating a Stateflow Truth Table, you create the truth table function ttable with the signature
Now you need to specify a call to the truth table function in the Stateflow diagram. Later, when the diagram executes during simulation, it calls the truth table.
You can call truth table functions from the actions of any state or transition. You can also call truth tables from other functions, including graphical functions and other truth tables. Also, if you export a truth table, you can call it from any Stateflow chart in the model.
Use the following steps to call the ttable function from the default transition of its own Stateflow diagram.
?) that appears on the highlighted default transition.
You might want to adjust the label's position by clicking and dragging it to a new location. The finished Stateflow diagram should have the following appearance:
The label on the default transition that you entered provides a condition action that calls the truth table with arguments and a return value. When Simulink triggers the Stateflow block during simulation, the default transition is taken and a call to the truth table ttable is made.
The call to the truth table in Stateflow action language must match the truth table signature. This means that the type of the return value c must match the type of the signature return value z, and the type of the arguments a and b must match the type of the signature arguments x and y. You ensure this with a later step in this section when you create the data that you use in Stateflow.
| Creating a Stateflow Truth Table | Creating Truth Table Data in Stateflow and Simulink | ![]() |
© 1994-2005 The MathWorks, Inc.