Main Content

destroy

Destroy data element and remove from data interface

Since R2022b

    In R2023b the Architectural Data section of data dictionaries was introduced. When managing interfaces, data types, constants, and software address methods consider using the Simulink.dictionary.ArchitecturalData programmatic interfaces instead. For more information, see Programmatically Manage AUTOSAR Architectural Data.

    Description

    destroy(dataElementObj) destroys the data element dataElementObj and removes it from its parent Simulink.interface.dictionary.DataInterface object.

    example

    Examples

    collapse all

    This example shows how to delete a data element and remove it from a data interface.

    Create a Simulink.interface.Dictionary object by opening an existing interface dictionary.

    interfaceDictObj = Simulink.interface.dictionary.open('myInterfaceDict.sldd')
    interfaceDictObj = 
      Dictionary with properties:
    
        DictionaryFileName: 'myInterfaceDict.sldd'
                Interfaces: [1×1 Simulink.interface.dictionary.DataInterface]
                 DataTypes: [0×0 Simulink.interface.dictionary.DataType]

    This interface dictionary has one data interface definition. The data interface has two data elements.

    interfaceObj = interfaceDictObj.Interfaces
    interfaceObj = 
      DataInterface with properties:
    
               Name: 'interface1'
        Description: ''
           Elements: [1×2 Simulink.interface.dictionary.DataElement]
              Owner: [1×1 Simulink.interface.Dictionary]
    
    

    Use the getElement function to access a data element.

    dataElem1 = getElement(interfaceObj,'element1')
    dataElem1 = 
    
      DataElement with properties:
    
               Name: 'element1'
               Type: [1×1 Simulink.interface.dictionary.ValueType]
        Description: ''
         Dimensions: '1'
              Owner: [1×1 Simulink.interface.dictionary.DataInterface]

    Use the destroy function to delete the data element and remove it from the data interface.

    destroy(dataElem1)
    interfaceObj
    interfaceObj = 
    
      DataInterface with properties:
    
               Name: 'interface1'
        Description: ''
           Elements: [1×1 Simulink.interface.dictionary.DataElement]
              Owner: [1×1 Simulink.interface.Dictionary]

    The data interface, interfaceObj now has only one data element.

    Input Arguments

    collapse all

    Data element to destroy, specified as a Simulink.interface.dictionary.DataElement object.

    Version History

    Introduced in R2022b

    collapse all

    R2023b: Simulink.interface.Dictionary object replaced by Simulink.dictionary.ArchitecturalData object

    Starting in R2023b, use the Simulink.dictionary.ArchitecturalData object to programmatically manage architectural data instead of the Simulink.interface.Dictionary object.