Main Content

removeElement

Remove element from physical interface

Since R2023b

    Description

    removeElement(physicalInterfaceObj,elementName) removes the physical element with the name elementName from the physical interface PhysicalInterfaceObj.

    example

    Examples

    collapse all

    To configure physical elements of a physical interface, use the addElement, getElement, and removeElement functions.

    In this example, the dictionary MyInterfaces.sldd contains one physical interface.

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

    Get the physical interface object using the getInterface function. The physical interface object contains two physical element objects.

    physInterfaceObj = getInterface(archDataObj,"PhysicalInterface1")
    physInterfaceObj = 
    
      PhysicalInterface with properties:
    
               Name: 'PhysicalInterface1'
        Description: ''
           Elements: [1×2 Simulink.dictionary.archdata.PhysicalElement]
              Owner: [1×1 Simulink.dictionary.ArchitecturalData]

    To create a physical element object and add it to the physical interface, use the addElement function.

    physElemObj3 = addElement(physInterfaceObj,"physElem3")
    physElemObj3 = 
    
      PhysicalElement with properties:
    
               Name: 'physElem3'
               Type: ''
        Description: ''
              Owner: [1×1 Simulink.dictionary.archdata.PhysicalInterface]

    To access an existing physical element, use the getElement function.

    physElemObj2 = getElement(physInterfaceObj,"physElem2")
    physElemObj2 = 
    
      PhysicalElement with properties:
    
               Name: 'physElem2'
               Type: ''
        Description: ''
              Owner: [1×1 Simulink.dictionary.archdata.PhysicalInterface]

    To remove a physical element from a physical interface, use the removeElement function.

    removeElement(physInterfaceObj,"physElem1")

    The physical interface object now contains only two physical elements, physElem2 and physElem3

    physInterfaceObj.Elements(1)
    ans = 
    
      PhysicalElement with properties:
    
               Name: 'physElem2'
               Type: ''
        Description: ''
              Owner: [1×1 Simulink.dictionary.archdata.PhysicalInterface]
    physInterfaceObj.Elements(2)
    ans = 
    
      PhysicalElement with properties:
    
               Name: 'physElem3'
               Type: ''
        Description: ''
              Owner: [1×1 Simulink.dictionary.archdata.PhysicalInterface]

    Input Arguments

    collapse all

    Physical interface containing the physical element, specified as a Simulink.dictionary.archdata.PhysicalInterface object.

    Physical element name, specified as a character vector or string scalar.

    Data Types: char | string

    Version History

    Introduced in R2023b