Incorporate MATLAB® code inside your Stateflow® charts. Implement algorithms that are more easily expressed by using MATLAB, such as matrix calculations and data analysis.
Create and execute MATLAB functions in a Stateflow chart.
Define the logical behavior of a MATLAB function.
Specialized semantics impact the way that a function initializes persistent data.
This example shows how to read from and write to Simulink® bus signals in a MATLAB® function by using MATLAB and Stateflow® structures.
Use breakpoints to debug MATLAB functions.
Extend the scope of your functions to other blocks in a Simulink® model.
Encapsulate reusable functions in a separate namespace.