Main Content

Connect Subsystems

To connect subsystems, use ports on a Subsystem block. The ports on a Subsystem block correspond with blocks inside the subsystem.

For example, this Subsystem block has two input ports and one output port.

Subsystem block with input ports labeled 1 and 2 and an output port labeled 1

The subsystem contains Inport blocks named In1 and In2 and an Outport block named Out1. These blocks correspond to input ports 1 and 2 and output port 1, respectively.

Subsystem that contains two Inport blocks and one Outport block

When you add a blank subsystem to a model, the subsystem contains an input port and an output port by default.

Add Ports to Subsystems

To add ports to a Subsystem block directly, perform one of these actions:

  • Click the edge of a Subsystem block. Then, select whether to create an input or output signal port, an input or output bus element port, or a connection port.

    The Subsystem block displays a placeholder for a new port. An action bar lets you choose the type of port to create.

  • Drag a line to the edge of a Subsystem block. This action creates an input signal port.

    The Subsystem block displays a placeholder for a new input port. An unconnected line approaches the edge of the block.

  • Drag a line from the edge of a Subsystem block. This action creates an output signal port.

    The Subsystem block displays a placeholder for a new output port. A line extends from the placeholder port.

These actions add corresponding port blocks inside the subsystem.

Tip

After port creation, the port label on the Subsystem block is enabled for quick editing. See Edit Port Labels on Subsystem Blocks.

Alternatively, open the subsystem by double-clicking the Subsystem block. Then, add the corresponding blocks to the subsystem.

Type of PortCorresponding Block
Signal port, inputInport block
Signal port, outputOutport block
Bus element port, inputIn Bus Element block
Bus element port, outputOut Bus Element block
Control port, enabledEnable block
Control port, triggeredTrigger block
Control port, function-callTrigger block with Trigger type set to function-call
Control port, resetReset block
Control port, actionAction Port block
Connection portConnection Port (Simscape) block

These blocks add corresponding ports to the Subsystem block.

Change Port Locations on Subsystem Blocks

To change the location of a port on a Subsystem block, drag the port to a new location on any side of the block.

A port is highlighted after having been dragged from the left side to the top side of the block.

Edit Port Labels on Subsystem Blocks

By default, the software labels the ports on a Subsystem block. To specify how the software labels the ports:

  1. Select the Subsystem block.

  2. On the Format tab of the Simulink® Toolstrip, select one of the labeling options from the Port Labels menu. For more information, see Show port labels.

You can directly edit the port labels on these types of Subsystem blocks:

  • Regular subsystem

  • Subsystem with mask

  • Variant subsystem

  • Chart subsystem

To edit the port label on a Subsystem block in the current model:

  1. Point to the port label. An interactive port label cue (blue box surrounding the port label) appears. Click the cue.

    Alternatively, select the port and press F2. The cue enters edit mode.

    Creating a new port on a Subsystem block using automatic port creation also enables the port label cue for quick editing.

    Editable port label cue

  2. A port selector cue appears above the port label cue to indicate the port label information that is being edited: the port block name, signal name, bus port, or connection port. For signal ports, you can edit both the port block name and the port signal name from the port label. To switch between the values, click the respective icon in the selector cue or use the keyboard shortcuts Ctrl+1,2.

  3. Enter a value in the port label cue and press Enter or Esc, or click away.

    Port selector cue above a port label cue

  4. After the port label is edited, the software automatically updates the name of the related port or signal within the subsystem.

    The updated port name inside the Subsystem

Tip

To make successive port label edits on a Subsystem block:

  1. Select a port on the block.

  2. Edit the port label and press Enter. This action enables keyboard selection of ports.

  3. Select adjacent ports using the up arrow or down arrow key and pressing F2 for quick editing.

This table lists the update action depending on the type of port label defined on the Subsystem block.

Type of Port LabelAction
NoneEditing not supported.
Port icon

Updates the names of elements in the subsystem depending on the Icon display parameter of the port.

For example, if the value of the Icon display parameter of the port is Signal name, then both the icon on the port block and the name of the linked signal are updated.

For this type of port label, the information shown on the port label after an edit depends on the final edit performed on the label using the selector cue:

  • If the initial port label shows the port block name, and the final edit is on the signal name, then the Icon display parameter for the underlying port block automatically updates to Signal name. So, after the edit, the port label shows the signal name by default.

  • If the initial port label shows the port signal name, and the final edit is on the port block name, then the Icon display parameter for the underlying port block automatically updates to Port number. So, after the edit, the port label shows the block name by default.

Port block nameUpdates the block name of the port in the subsystem. For this type of port label, you can edit only the port block name using the port selector cue.
Signal name

Updates the name of the signal linked to the port.

Subsystem port labels show the name of propagated signals when all these conditions are true:

  • The value of the Icon display parameter for the underlying port block is Signal name.

  • The internal signal within the subsystem is connected but does not have a name.

  • The propagated signal has a name.

Port Editing Limitations

  • The software does not show the port selector cue for Chart blocks.

  • Editing port labels on Subsystem blocks with a mask icon is not supported.

  • Editing port numbers from the port label is not supported. You can still edit the port block name and signal name using the port label cue.

  • Editing name of propagated signals from the port label is not supported. You can still edit the port block name and internal signal name using the port label cue. When you click the cue, the port signal name field is empty because the internal signal does not have a name.

See Also

Related Topics