Main Content

Types of Structures in MATLAB Function Blocks

In MATLAB Function blocks, you can define structure data as inputs or outputs that interact with bus signals. MATLAB Function blocks also support arrays of buses. You can also define structures inside MATLAB® functions that are not part of MATLAB Function blocks.

The following table summarizes how to create different types of structures in MATLAB Function blocks:

ScopeHow to CreateDetails
InputCreate structure data with scope of Input.You can create structure data as inputs or outputs in the top-level MATLAB function for interfacing to other environments. See Create Structures in MATLAB Function Blocks.
OutputCreate structure data with scope of Output.
LocalCreate a local variable implicitly in a MATLAB function.See Define Scalar Structures for Code Generation.
PersistentDeclare a variable to be persistent in a MATLAB function.See persistent.
ParameterCreate structure data with scope of Parameter.See Define and Use Structure Parameters.

Structures in MATLAB Function blocks can contain fields of any type and size, including mux signals, buses, and arrays of structures.

See Also

Related Topics