Main Content

isenum

Determine if variable is enumeration

Description

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

If e is a heterogeneous array, isenum always returns false.

Examples

Test for Enumeration

Determine if a variable is an enumeration.

The PPM class defines enumerations for three levels:

classdef PPM < int32
   enumeration
      High (1000)
      Medium (100)
      Low (10)
   end
end

Create a variable representing a level. Use isenum to 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, see Named Values.

Extended Capabilities

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

Introduced in R2015a