Main Content

addPort

Add ports to architecture

Description

ports = addPort(arch,portNames,portTypes) adds a set of ports with names specified by portNames and the types specified by portTypes. The addPort function adds ports to the architecture of a component or the root architecture of the model. Use <component>.Architecture to access the architecture of a component.

To remove a port, use the destroy function.

example

ports = addPort(arch,portNames,portTypes,stereotypes) also applies the stereotypes specified in stereotypes to a set of new ports.

Examples

collapse all

Create a model, get the root architecture, add a component, and add a port.

model = systemcomposer.createModel("archModel");
systemcomposer.openModel("archModel");
rootArch = get(model,"Architecture");
newComponent = addComponent(rootArch,"NewComponent");
newPort = addPort(newComponent.Architecture,"NewCompPort","in")
newPort = 

  ArchitecturePort with properties:

                 Parent: [1×1 systemcomposer.arch.Architecture]
                   Name: 'NewCompPort'
              Direction: Input
          InterfaceName: ''
              Interface: [0×0 systemcomposer.interface.DataInterface]
             Connectors: [0×0 systemcomposer.arch.Connector]
              Connected: 0
                  Model: [1×1 systemcomposer.arch.Model]
         SimulinkHandle: 57.0018
    SimulinkModelHandle: 10.0018
                   UUID: 'f3dd03e1-af14-47ed-88c8-0ce301b2da5f'
            ExternalUID: ''

Input Arguments

collapse all

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

Names of ports, specified as a cell array of character vectors or array of strings, or as a character vector or string for a single port name. If necessary, the software appends a number to the port name to ensure uniqueness.

Data Types: char | string

Port types, specified as a cell array of character vectors or array of strings, or as a character vector or string for a single port type. Available port types include:

  • "in"

  • "out"

  • "physical"

  • "client" for software architectures

  • "server" for software architectures

An array of port types gets applied one to one with the array of port names.

Data Types: char | string

Stereotypes to apply to ports, specified as an array of strings in the form "<profile>.<stereotype>". Specify one stereotype that gets applied to all ports or an array of stereotypes that gets applied one to one with the array of port names.

Data Types: string

Output Arguments

collapse all

Created ports, returned as an array of systemcomposer.arch.ArchitecturePort objects.

More About

collapse all

Version History

Introduced in R2019a