Main Content


Add enumerated type to Architectural Data section of Simulink data dictionary

Since R2023b



    dataType = addEnumType(archDataObj,dataTypeName) adds a Simulink® enumeration dataTypeName to archDataObj, the Architectural Data section of a data dictionary.


    collapse all

    To add a Simulink enumeration with a specified name to the data dictionary, use the addEnumType function. For an example that shows more of the workflow for related functions, see Create Architectural Data Object and Use It to Configure Architectural Data.

    Create or open a data dictionary. This example uses a previously created data dictionary MyInterfaces.sldd.

    dictName = "MyInterfaces.sldd";
    archDataObj =;

    Add enumerated data type objects to the data dictionary using the addEnumType function. You can specify the name, default value, storage type, and write a description of the enumerated data type using the enumerated data type object.

    myEnumType1 = addEnumType(archDataObj,"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

    Architectural Data object, specified as a Simulink.dictionary.ArchitecturalData object.

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

    Example: "airSpeed"

    Output Arguments

    collapse all

    Enumerated data type object, returned as Simulink.dictionary.archdata.EnumType object.

    Version History

    Introduced in R2023b