Main Content

addEnumType

Add enumerated type to Simulink interface dictionary

Since R2022b

Description

example

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

Examples

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.

% open interface dictionary
dictName = 'MyInterfaces.sldd';
dictAPI = Simulink.interface.dictionary.open(dictName);

% add enumerated type
myEnumType1 = addEnumType(dictAPI,'myColor');
myEnumType1.addEnumeral('RED', '0', 'Solid Red');
myEnumType1.addEnumeral('BLUE', '1', 'Solid Blue');
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, create or open dictObj by using Simulink.interface.dictionary.create or Simulink.interface.dictionary.open.

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

Example: "airSpeed"

Output Arguments

collapse all

Enumerated type, returned as Simulink.interface.dictionary.EnumType object.

Version History

Introduced in R2022b

expand all