Documentation Center

  • Trial Software
  • Product Updates

Instantiate Enumerated Data in MATLAB Function Blocks

To instantiate an enumerated type in a MATLAB Function block, use dot notation to specify ClassName.EnumName. For example, the following MATLAB® function checkState instantiates the enumerated types myMode and myLED from Control an LED Display. The dot notation appears highlighted in the code.

function led = checkState(state)

if state == myMode.ON
    led = myLED.GREEN;
    led = myLED.RED;
Was this topic helpful?