Main Content

underlyingValue

Underlying numeric value for C++ enumeration object created in MATLAB

Description

example

underlyingValue(cppEnum) returns the underlying numeric value for a C++ enumeration object created in MATLAB®. underlyingValue is an instance method of the enumeration.

Examples

collapse all

Create a file enums.hpp with these statements.

enum class COLOR {

RED=100,
BLUE=500,
BLACK=1000,
WHITE=5000,

};

Build the C++ interface.

clibgen.buildInterface('enums.hpp')
addpath enums

Type clib.enums.COLOR., then press Tab. Select BLACK.

Display the underlying numeric value.

underlyingValue(clib.enums.COLOR.BLACK)
ans =

  int32

   1000

Input Arguments

collapse all

C++ enumeration created in MATLAB, specified as a C++ enumeration object.

Example: clib.enums.COLOR.BLACK

Version History

Introduced in R2019a