Generate C++ enum class from MATLAB® enumeration
R2026bWhether to generate C++ enumeration classes for MATLAB enumerations
Since R2022a
Description
App Configuration Pane: C++ Language Features
Configuration Objects: coder.MexCodeConfig | coder.CodeConfig | coder.EmbeddedCodeConfig
The Generate C++ enum class from MATLAB enumeration parameter specifies whether to convert MATLAB enumerations to C++ enumeration classes. You can only set this parameter when you generate C++ code with a language standard of C++11 or later.
Individual enumerations can override this parameter by providing a
generateEnumClass static method that returns
true or false. When an enumeration defines
this method, the method return value takes precedence over the value of the
Generate C++ enum class from MATLAB enumeration
parameter.
For imported enumerations, ensure that the external header file defines the enumeration using the form that matches what the code generator expects. If the code generator expects an enumeration class but the header file defines an ordinary enumeration (or vice versa), the C++ compiler reports a build error.
Dependencies
To enable this parameter, set the Language parameter to C++ and set the
Language
Standard parameter to C++11 (ISO) or
later.
Settings
- On
The code generator converts MATLAB enumerations to enumeration classes in the generated C++ code, unless you specify a
generateEnumClassstatic method. This setting is the default.- Off
The code generator produces ordinary C enumerations for MATLAB enumerations in the generated C++ code, unless you specify a
generateEnumClassstatic method.
Programmatic Use
Property:
CppGenerateEnumClass |
Values: true |
false |
Default: true |
Version History
Introduced in R2022a