Main Content

isenum

Determine if variable is enumeration

Description

tf = isenum(e)returns logical 1 (true) ifeis an enumeration. Otherwise, it returns logical 0 (false). Empty enumeration objects returntrue.

Ifeis a heterogeneous array,isenumalways returnsfalse.

Examples

Test for Enumeration

Determine if a variable is an enumeration.

ThePPMclass defines enumerations for three levels:

classdefPPM < int32enumerationHigh (1000) Medium (100) Low (10)endend

Create a variable representing a level. Useisenumto determine if the variable is an enumeration:

currentLevel = PPM.High; isenum(currentLevel)
ans = 1

Input Arguments

collapse all

Input array, specified as any MATLAB®variable.

More About

collapse all

Enumerations

Enumerations are a fixed set of names representing a single type of value. For more information, seeNamed Values.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2015a