| Stateflow User's Guide | ![]() |
Graphical Functions
A graphical function is a function defined graphically by a flow diagram that provides convenience and power to Stateflow action language.
The following example shows a graphical function side by side in a Stateflow diagram with the transition that calls it:
In this example the function z = f(x,y) is called in the condition action of the transition from state A to state B. The function is defined using symbols that are valid only within the function itself. The function is called using data objects available to states A and B and their parent states (if any).
Graphical functions are similar to textual functions such as MATLAB and C functions in the following ways:
Unlike C and MATLAB functions, however, graphical functions are full-fledged Stateflow graphical objects. You use the Stateflow editor to create them and they reside in your Stateflow model along with the diagrams that invoke them. This makes graphical functions easier to create, access, and manage than textual custom code functions, whose creation requires external tools, and whose definition resides separately from the model.
| Boxes | Stateflow Semantics | ![]() |
© 1994-2005 The MathWorks, Inc.