Main Content

getEnumeral

Get enumeration member of enumerated data type in Architectural Data section of data dictionary

Since R2023b

    Description

    enumMember = getEnumeral(enumType,enumMemberName) returns the Simulink.dictionary.archdata.Enumeral object with the name enumMemberName in the enumerated data type enumType.

    example

    enumMember = getEnumeral(enumType,enumMemberIndex) returns the Simulink.dictionary.archdata.Enumeral object with the index enumMemberIndex in the enumerated data type enumType.

    Examples

    collapse all

    Create a Simulink.dictionary.ArchitecturalData object to retrieve the contents of the Architectural Data section of a data dictionary. Use the getDataType function to get the enumerated data type definition. This example uses a previously created Simulink.data.dictionary.EnumTypeDefinition object MyShapes.

    archdata = Simulink.dictionary.archdata.create('myArchitecturalData.sldd');
    enums = getDataType(archdata,"MyShapes");

    Get an enumeration member of enumerated data type MyShapes by specifying its name.

    enumMember = getEnumeral(enums,"Triangle")
    enumMember = 
    
      Enumeral with properties:
    
               Name: 'Triangle'
              Value: '3'
        Description: 'A triangle has 3 sides.'

    Get an enumeration member of MyShapes by specifying its index in the enumerated data type.

    enumMember = getEnumeral(enums,4)
    enumMember = 
    
      Enumeral with properties:
    
               Name: 'Pentagon'
              Value: '5'
        Description: ''

    Input Arguments

    collapse all

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

    Name of enumeration member in an enumerated data type enumType, specified as a character vector or string scalar.

    Example: getEnumeral(enumType,"Square")

    Data Types: char | string

    Index of enumeration member in the enumerated data type enumType, specified as an integer.

    Example: getEnumeral(enumType,3)

    Data Types: single

    Output Arguments

    collapse all

    Enumeration member of an enumerated data type stored in the Architectural Data section of a data dictionary, specified by a Simulink.dictionary.archdata.Enumeral object.

    Version History

    Introduced in R2023b