Main Content

MATLAB Function

R2026b

MATLAB function in Stateflow chart

Description

A MATLAB® function defines algorithms by using MATLAB code inside a Stateflow® chart. Call a MATLAB function in the actions of states and transitions to perform matrix-oriented calculations, data analysis, and visualization.

To add a MATLAB function to a chart:

  1. In the Stateflow Editor, in the object palette, click the MATLAB Function icon The MATLAB function object palette icon..

  2. Click a location in the chart canvas to place the MATLAB function.

  3. Type a function signature in the format y = f(x).

Properties

expand all

To edit graphical object properties interactively, right-click the object and select Properties.

To modify MATLAB function properties programmatically, use Stateflow.EMFunction objects.

General

Name of the MATLAB function in the chart hierarchy. This property is read-only. Click the hyperlink to navigate to the function in the Stateflow Editor. To change the name, edit the Label property.

Appearance of the MATLAB function in generated code, specified as one of these values:

  • Auto — An internal calculation determines the appearance of the function in generated code.

  • Function — A separate C function implements the function.

  • Inline — If the function is not part of a recursion, calls to the function are replaced by code.

Label for the MATLAB function, specified as a character vector. The label defines the function signature, including input and output arguments, as it appears in the Stateflow Editor.

Version History

Introduced before R2006a