Documentation

isenum

Determine if variable is enumeration

Syntax

tf = isenum(e)

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.

Extended Capabilities

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

Introduced in R2015a

Was this topic helpful?