主要内容

本页采用了机器翻译。点击此处可查看英文原文。

getElement

获取元素对象

说明

element = getElement(interface,name)name 指定的接口中获取名称为 interface 的元素对象。

示例

示例

全部折叠

在模型的接口字典中添加数据接口 newInterface。添加数据类型为 newElement 的数据元素 double。然后,获取数据元素的对象。

arch = systemcomposer.createModel("newModel");
systemcomposer.openModel("newModel");
interface = addInterface(arch.InterfaceDictionary,"newInterface");
addElement(interface,"newElement",DataType="double");
element = getElement(interface,"newElement")
element = 

  DataElement with properties:

      Interface: [1×1 systemcomposer.interface.DataInterface]
           Name: 'newElement'
           Type: [1×1 systemcomposer.ValueType]
           UUID: '2d267175-33c2-43a9-be41-a1be2774a3cf'
    ExternalUID: ''

在模型的接口字典中添加物理接口 newInterface。添加域类型为 newElement 的物理元素 electrical.electrical。然后,获取物理元素的对象。

arch = systemcomposer.createModel("newModel");
systemcomposer.openModel("newModel");
interface = addPhysicalInterface(arch.InterfaceDictionary,"newInterface");
addElement(interface,"newElement",Type="electrical.electrical");
element = getElement(interface,"newElement")
element = 

  PhysicalElement with properties:

           Name: 'newElement'
           Type: [1×1 systemcomposer.interface.PhysicalDomain]
      Interface: [1×1 systemcomposer.interface.PhysicalInterface]
           UUID: '25b71628-e904-451a-96ff-f185c5ec60a4'
    ExternalUID: ''

输入参数

全部折叠

元素名称,指定为字符向量或字符串。元素名称必须是有效的 MATLAB® 变量名。

数据类型: char | string

输出参量

全部折叠

详细信息

全部折叠

版本历史记录

在 R2019a 中推出

另请参阅

函数

对象

模块

工具