| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Stateflow |
| Contents | Index |
| Learn more about Stateflow |
| On this page… |
|---|
A graphical function is a function defined graphically by a flow graph that includes Stateflow action language.
This figure shows a graphical function side by side in a Stateflow chart 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 C and MATLAB functions in these ways:
Graphical functions can accept arguments and return results.
You can invoke graphical functions in transition and state actions.
Unlike C and MATLAB functions, however, graphical functions are native Stateflow graphical objects. You use the Stateflow Editor to create them, and they reside in your Stateflow chart. This property 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 chart.
For more information, see Using Graphical Functions to Extend Actions.
![]() | History Junctions | Boxes | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |