addPort

Add ports to architecture

Description

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

ports = addPort(architecture,portNames,portTypes,stereotypes) also applies stereotypes.

Examples

collapse all

Create model, get root architecture, add 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

addPort adds ports to the architecture of a component. Use <component>.Architecture to access the architecture of a component.

Data Types: systemcomposer.arch.Architecture

Port names must be unique within each component. 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: string

Port directions are given in a cell array. Each element is either 'in' or 'out'.

Data Types: string

Each stereotype in the array must either be a mixin stereotype or a port stereotype. The size of portNames,portTypes, and stereotypes must be the same.

Data Types: systemcomposer.profile.Stereotype

Output Arguments

collapse all

Introduced in R2019a