MATLAB Functions

Write matrix-oriented algorithms for data analysis and visualization

Incorporate MATLAB® code inside your Stateflow® charts. Implement algorithms that are more easily expressed by using MATLAB, such as matrix calculations and data analysis.

Topics

Reusable Functions in Charts

Specify function calls in states and transitions.

Reuse MATLAB Code by Defining MATLAB Functions

Create and execute MATLAB functions in a Stateflow chart.

Program a MATLAB Function in a Chart

Define the logical behavior of a MATLAB function.

Initialize Persistent Variables in MATLAB Functions

Specialized semantics impact the way that a function initializes persistent data.

Connect Structures in MATLAB Functions to Simulink Bus Signals

Access Simulink® bus signals within MATLAB functions.

Debug a MATLAB Function in a Chart

Use breakpoints to debug MATLAB functions.

Export Stateflow Functions for Reuse

Extend the scope of your functions to other blocks in a Simulink model.

Reuse Functions by Using Atomic Boxes

Encapsulate reusable functions in a separate namespace.

Featured Examples