Stateflow | ![]() ![]() |
Graphical Functions
A graphical function is a function defined graphically by a flow graph 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. Like C and MATLAB functions, graphical functions can accept arguments and return results. Like C and MATLAB functions, you invoke graphical functions in transition and state actions. 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 functions, whose creation requires external tools and whose definitions reside separately from the model.
![]() | Boxes | Action Language | ![]() |