Pass Enumerated Types

In MATLAB®, you can express an enumerated type as either the enumeration string or its equivalent numeric value.

The readEnum function from the shrlibsample library displays a string that matches the input argument.

 readEnum Function Signature

Look at the definition in the shrlibsample.h header file for information about the values for the Enum1 input.

 Enum1 enum Definition

Call Function with Enumeration String

This example shows how to call readEnum with a string.

calllib('shrlibsample','readEnum','en4')
ans =
   You chose en4

Call Function with Integer Equivalent of Enumeration

This example shows how to call readEnum with the numeric argument.

The Enum1 definition declares enumeration en4 equal to 4.

calllib('shrlibsample','readEnum',4)
ans =
   You chose en4
Was this topic helpful?