Main Content

Add Enumerated Inputs, Outputs, and Parameters to aMATLAB FunctionBlock

When you add enumerated inputs, outputs, or parameters to aMATLAB Functionblock, 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 aMATLAB Functionblock:

  1. In theSymbolspane, add a new variable. In theNamefield, enter a name for the enumerated data.

    For parameters, the name must match the enumerated masked parameter or workspace variable name.

  2. In the Property Inspector, in theTypefield, specify an enumerated type.

    • For an explicit enumerated type, setTypetoEnum: . Replacewith the name of an enumerated data type that you defined in a MATLAB file on the MATLAB path.

      TheComplexityfield 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), setTypetoInherit: Same as Simulink.

Related Topics