Main Content


Add an enum type to Simulink Interface Dictionary



dataType = addEnumType(dictObj,dtName) adds a Simulink enumeration with the specified name to the dictionary.


collapse all

To add a Simulink enumeration with the specified name to the dictionary, use the addEnumType function. For an example that shows more of the workflow for related functions, see Create and Configure Interface Dictionary.

%% Enum Types
myEnumType1 = addEnumType(dictAPI,'myColor');
myEnumType1.addEnumeral('RED', '0', 'RED BLOOD');
myEnumType1.addEnumeral('BLUE', '1', 'Blue Skies');
myEnumType1.DefaultValue = 'BLUE';
myEnumType1.Description = 'I am a Simulink Enumeration';
myEnumType1.StorageType = 'int16';

Input Arguments

collapse all

Interface dictionary, specified as a Simulink.interface.Dictionary object. Before you use this function, represent the target dictionary with a Simulink.interface.Dictionary object by using Simulink.interface.dictionary.create or

DataType definition name in DataTypes property array of dictObj, specified as a character vector or a string scalar.

Example: "airSpeed"

Output Arguments

collapse all

Data type of dtName, specified as a character vector or string for a valid MATLAB data type.

Version History

Introduced in R2022b