Main Content

addEnumeral

Add enumeration member to enumerated data type in Architectural Data section of data dictionary

Since R2023b

    Description

    enumMember = addEnumeral(enumType,enumMemberName,enumMemberValue) adds an enumeration member with name enumMemberName and value enumMemberValue to the enumerated data type object stored in the Architectural Data section of a data dictionary specified by enumType.

    example

    enumMember = addEnumeral(enumType,enumMemberName,enumMemberValue,description) adds an enumeration member with a description to the to the enumerated data type object stored in the Architectural Data section of a data dictionary specified by enumType in addition to the input arguments of the previous syntaxes.

    example

    Examples

    collapse all

    This example shows how to add an enumeration member to an existing Simulink.dictionary.archdata.EnumType in the Architectural Data section of a data dictionary use the addEnumeral function.

    Add an enumerated data type to a data dictionary by using the addEnumType function.

    archData = Simulink.dictionary.archdata.create("dataDict.sldd");
    enumeratedDataType = addEnumType(archData,"enumType")
    
    enumeratedDataType = 
    
      EnumType with properties:
    
                Name: 'enumeratedDataType'
         Description: ''
        DefaultValue: 'enum1'
         StorageType: 'Native Integer'
           Enumerals: [1×1 Simulink.dictionary.archdata.Enumeral]
               Owner: [1×1 Simulink.dictionary.ArchitecturalData]

    Add an enumeration member to an architectural data enumerated data type by using the addEnumeral function.

    enumMember = addEnumeral(enumeratedDataType,"anEnumMember",2,...
        "This is an enumeration member in the architectural data section with value 2.")
    enumMember = 
    
      Enumeral with properties:
    
               Name: 'anEnumMember'
              Value: '2'
        Description: 'This is an enumeration member in the architectural data section with value 2.'

    Input Arguments

    collapse all

    An enumerated data type in the Architectural Data section of a data dictionary, specified by a Simulink.dictionary.archdata.EnumType object.

    Example: enumType = addEnumType(archData,'EnumType');

    Name of an enumeration member of an enumerated data type in the Architectural Data section of a data dictionary, specified as a character vector or string scalar.

    Example: 'enumeratedDataType'

    Data Types: char | string

    Value of the enumeration member, specified as a real scalar integer, character vector, or string scalar whose absolute numeric value is less than 231 and compatible with the StorageType property of the parent Simulink.dictionary.archdata.EnumType object.

    Example: addEnumeral(enumType,"anEnumMember",55,"Enumeration member with value 55.")

    Example: addEnumeral(enumType,"anotherEnumMember",-16,"Enumeration member with value -16.")

    Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

    Custom description of the enumeration member of the enumerated data type in the Architectural Data section of a data dictionary, specified as a character vector or string scalar.

    Example: "Enumeration member with value -16."

    Data Types: char | string

    Output Arguments

    collapse all

    Enumeration member, returned as Simulink.dictionary.archdata.Enumeral object.

    Version History

    Introduced in R2023b