Main Content

destroy

Delete data element and remove from data interface

Since R2023b

    Description

    example

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

    Examples

    collapse all

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

    Create a Simulink.dictionary.ArchitecturalData object by opening an existing data dictionary.

    archDataObj = Simulink.dictionary.archdata.open("myInterfaces.sldd")
    archDataObj = 
    
      ArchitecturalData with properties:
    
        DictionaryFileName: 'myInterfaces.sldd'
                Interfaces: [1×1 Simulink.dictionary.archdata.DataInterface]
                 DataTypes: [0×0 Simulink.dictionary.archdata.DataType]
                 Constants: [0×0 Simulink.dictionary.archdata.Constant]

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

    interfaceObj = getInterface(archDataObj,"DataInterface")
    interfaceObj = 
    
      DataInterface with properties:
    
               Name: 'DataInterface'
        Description: ''
           Elements: [1×2 Simulink.dictionary.archdata.DataElement]
              Owner: [1×1 Simulink.dictionary.ArchitecturalData]

    Use the getElement function to access a data element.

    dataElem1 = getElement(interfaceObj,"element1")
    dataElem1 = 
    
      DataElement with properties:
    
               Name: 'element1'
               Type: [1×1 Simulink.dictionary.archdata.ValueType]
        Description: ''
         Dimensions: '1'
              Owner: [1×1 Simulink.dictionary.archdata.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: 'DataInterface'
        Description: ''
           Elements: [1×1 Simulink.dictionary.archdata.DataElement]
              Owner: [1×1 Simulink.dictionary.ArchitecturalData]

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

    Input Arguments

    collapse all

    Data element to delete and remove, specified as a Simulink.dictionary.archdata.DataElement object.

    Version History

    Introduced in R2023b