getElement
Description
returns the physical element object with the name physicalElemObj
= getElement(physicalInterfaceObj
,elementName
)elementName
contained in the physical interface object,
physicalInterfaceObj
.
Examples
Configure Physical Elements of a Physical Interface
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
physicalInterfaceObj
— Physical interface
Simulink.dictionary.archdata.PhysicalInterface
object
Physical interface containing the physical element, specified as a Simulink.dictionary.archdata.PhysicalInterface
object.
elementName
— Physical element name
character vector | string scalar
Physical element name, specified as a character vector or string scalar.
Data Types: char
| string
Output Arguments
physicalElemObj
— Physical element
Simulink.dictionary.archdata.PhysicalElement
object
Physical element with the name elementName
, returned as a
Simulink.dictionary.archdata.PhysicalElement
object.
Version History
Introduced in R2023b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)