Main Content

addPort

Add ports to architecture

Description

example

ports = addPort(architecture,portNames,portTypes) adds a set of ports with specified names.

ports = addPort(architecture,portNames,portTypes,stereotypes) also applies stereotypes to a set of ports.

Examples

collapse all

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

model = systemcomposer.createModel('archModel');
rootArch = get(model,'Architecture');
newcomponent = addComponent(rootArch,'NewComponent');
newport = addPort(newcomponent.Architecture,'NewCompPort','in');

Input Arguments

collapse all

Component architecture, specified as a systemcomposer.arch.Architecture object. addPort adds ports to the architecture of a component. Use <component>.Architecture to access the architecture of a component.

Names of ports, specified as a cell array of character vectors. If necessary, System Composer™ appends a number to the port name to ensure uniqueness. The size of portNames, portTypes, and stereotypes must be the same.

Data Types: char

Port directions, specified as a cell array of character vectors. A port direction can be either 'in' or 'out'.

Data Types: char

Stereotypes to apply to components, specified as a cell array of systemcomposer.profile.Stereotype objects. Each stereotype in the array must either be a stereotype that applies to all element types, or a port stereotype.

Output Arguments

collapse all

Created ports, returned as a cell array of systemcomposer.arch.ComponentPort or systemcomposer.arch.ArchitecturePort objects.

Introduced in R2019a