When you add enumerated inputs, outputs, or parameters to a MATLAB Function block, follow these guidelines:
For inputs, inherit the type from the enumerated type of the connected Simulink® signal or specify the enumeration explicitly.
For outputs, specify the enumerated type explicitly.
For tunable parameters, specify the enumerated type explicitly. For nontunable parameters, derive properties from an enumerated parameter in a parent Simulink masked subsystem or enumerated variable defined in the MATLAB® base workspace.
To add enumerated data to a MATLAB Function block:
In the MATLAB Function Block Editor, select Edit Data.
In the Ports and Data Manager, select Add > Data.
In the Name field, enter a name for the enumerated data.
For parameters, the name must match the enumerated masked parameter or workspace variable name.
In the Type field, specify an enumerated type.
For an explicit enumerated type, set Type to Enum:<class
name>
. Replace <class name>
with
the name of an enumerated data type that you defined in a MATLAB file
on the MATLAB path.
The Complexity field is not visible because enumerated data types do not support complex values.
To inherit the enumerated type from a connected Simulink signal
(for inputs only), set Type to Inherit:Same
as Simulink
.