connect

Connect pairs of components

Description

connectors = connect(srcComponent,destComponent) connects the unconnected output ports of srcComponent to the unconnected input ports of destComponent based on matching port names, and returns a handle to the connector.

connectors = connect(srcComponent,destComponent,'Stereotype',stereotype) additionally applies the specified stereotype to the connector.

connectors = connect(srcComponent,destComponent,'Rule',rule) specifies a rule for establishing connections.

connectors = connect(architecture,srcPorts,destPorts,stereotypes,rule) connects pairs of ports in the architecture.

Examples

collapse all

Create model, get root architecture, add ports, and connect ports.

model = systemcomposer.createModel('archModel'); 
rootArch = get(model,'Architecture'); 
names = {'Component1','Component2'}; 
newcomponents = addComponent(rootArch,names); 
outport1 = addPort(newcomponents(1).Architecture,'','OutputPort'); 
inport1 = addPort(newcomponents(2).Architecture,'InputPort',''); 
connect(rootArch,outport1, inport1);

Input Arguments

collapse all

Data Types: systemcomposer.arch.Architecture

srcPorts must be the same length as destPorts and must consist of all output ports.

Data Types: systemcomposer.arch.Port

destPorts must be the same length as srcPorts and must consist of all source ports.

Data Types: systemcomposer.arch.Port

Data Types: systemcomposer.arch.Component

Data Types: systemcomposer.arch.Component

Data Types: systemcomposer.profile.Stereotype

Data Types: systemcomposer.arch.Component

Output Arguments

collapse all

Introduced in R2019a