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 (for more information, see Combine Buses into an Array of Buses). You can also define structures inside MATLAB® functions that are not part of MATLAB Function blocks (see Structure Definition for Code Generation.

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 Make Structures Persistent.
ParameterCreate structure data with scope of ParameterSee Define and Use Structure Parameters.

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

Was this topic helpful?