This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Add Enumerated Inputs, Outputs, and Parameters to a MATLAB Function Block

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:

  1. In the MATLAB Function Block Editor, select Edit Data.

  2. In the Ports and Data Manager, select Add > Data.

  3. 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.

  4. 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.

Related Topics

Was this topic helpful?