Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

isenum

Determine if variable is enumeration

Syntax

tf = isenum(e)

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

Was this topic helpful?