Main Content

addFunction

Add functions to architecture of software component

Since R2022a

Description

functions = addFunction(arch,functionNames) adds a set of functions with the names specified, functionNames to the software architecture component architecture. The addfunction function adds functions to the software architecture of a component. Use <component>.Architecture to access the architecture of a component.

To remove a function, use the destroy function.

example

Examples

collapse all

Create a model named mySoftwareArchitecture and get the root architecture.

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

Create a software component and two 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]
  

Input Arguments

collapse all

Architecture, specified as a systemcomposer.arch.Architecture object.

Names of functions, specified as a cell array of character vectors or an array of strings.

Data Types: char | string

Output Arguments

collapse all

Created functions, returned as an array of systemcomposer.arch.Function objects.

More About

collapse all

Version History

Introduced in R2022a