主要内容

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

addFunction

为软件组件的架构添加函数

自 R2022a 起

说明

functions = addFunction(arch,functionNames) 将一组名称为 functionNames 的函数添加到软件架构组件架构中。addfunction 函数为组件的软件架构添加功能。使用 <component>.Architecture 访问组件的架构。

要删除函数,请使用 destroy 函数。

示例

示例

全部折叠

创建名为 mySoftwareArchitecture 的模型,并获取根架构。

model = systemcomposer.createModel("mySoftwareArchitecture","SoftwareArchitecture");
rootArch = model.Architecture
Architecture with properties:
 
                   Name: 'mySoftwareArchitecture'
             Definition: Composition
                 ...
            ExternalUID: ''
              Functions: []
  

创建一个软件组件和两个函数。

newComp = rootArch.addComponent("C1");
newFuncs = newComp.Architecture.addFunction({'f1','f2'});
rootArch
rootArch =
 
  Architecture with properties:
 
                   Name: 'mySoftwareArchitecture'
             Definition: Composition
                ...
            ExternalUID: ''
              Functions: [1x2 systemcomposer.arch.Function]
  

输入参数

全部折叠

架构,指定为 systemcomposer.arch.Architecture 对象。

函数名称,指定为字符向量元胞数组或字符串数组。

数据类型: char | string

输出参量

全部折叠

创建的函数,以 systemcomposer.arch.Function 对象数组的形式返回。

详细信息

全部折叠

版本历史记录

在 R2022a 中推出