Main Content

Extend the Model and Create Subsystems

Add More Blocks

Suppose that you want to multiply the absolute value of the output from the Sine Wave block. To do this, you can add an Abs block and another Gain block to the model by using different techniques to locate and add blocks.

  1. If you know the name of the block that you want to add, you can use the quick insert menu. Double-click where you want to add the block, and type the block name. In this case, enter gain.

    Quick insert menu, with the word "gain" entered in the search field, and the cursor pointing at the first search result

    The suggestions are dynamically ranked based on your recent block usage history.

  2. Click the block name or, with the block name highlighted, press Enter. You can use the arrow keys to highlight the block name if it is not first in the list.

  3. Some blocks display a prompt for you to enter a value for one of the block parameters. The Gain block prompts you to enter the Gain value. Type 3 and press Enter.

  4. To perform an absolute value, add an Abs block. Suppose you do not know the library a block is in or the full name of the block. You can search for it using the search box in the Library Browser. Open the Library Browser. In the search box, type abs and press Enter. When you find the Abs block, add it to the left of the new Gain block.

  5. Add another Scope block. You can right-click the existing Scope block and drag to create a copy or use the Copy and Paste commands.

    The figure shows the current state of the model.

    A Sine Wave block that is connected to a Gain block with a value of three, a Scope block that is connected to the Gain block, and three unconnected blocks: an Abs block, a Gain block with a value of three, and a Scope block

Branch a Connection

The input to the second Gain block is the absolute value of the output from the Sine Wave block. To use a single Sine Wave block as the input to both gain operations, create a branch from the Sine Wave block output signal.

  1. For the first set of blocks in your model, you used the horizontal alignment guides to help you align and connect them. You can also use guides to align blocks vertically. Drag the second Scope block so that it lines up under the first one. Release it when the vertical alignment guide shows that the blocks are aligned.

    A Scope block whose vertical alignment with a Gain block is indicated by a transparent blue horizontal line, and whose horizontal alignment with a second Scope block is indicated by a transparent blue vertical line

  2. You can click a port to identify compatible ports that can be connected to it. The port hint symbol appears near the compatible elements.

    1. Click the output port of the Gain block.

      The output port of a gain block is highlighted in blue

    2. Point to Port hint symbol to see the connection cue.

      Port Connection cue

    3. Click the cue to connect the Gain block to the Scope block.

      Connected port

    4. Connect the output port of the Abs block to the input port of the Gain block.

      The model from step 1, with the Abs block input port unconnected, the Abs block output port connected to the second Gain block, and the second Gain block connected to the second Scope block

  3. Create a branch from the Sine Wave block output to the Abs block. Click the input port of the Abs block. Move the cursor toward the output signal line from the Sine Wave block. A preview line appears. Click to create the branch.

    Model showing a preview of a branch line that runs from the signal line between the Sine Wave and Gain blocks to the inlet port of the Abs block

    Alternatively, you can start the branch by clicking the line segment and then moving the cursor toward the port.

  4. Name the signals. Double-click the signal line between the bottom Gain block and Scope block and type Scope. The label appears next to the signal line.

    The model from step 2 with the branch line added in step 3, and the label Scope visible underneath the signal line that runs between the second Gain block and the second Scope

Try these methods to add or connect blocks:

  • To get a list of recommended blocks to connect to an unconnected signal line, drag from a block port and release so that a red, dotted line appears. Double-click the end of the line to use the quick insert menu. Suggested blocks for the current context appear on the menu. You can select one of the listed blocks.

    To improve the menu suggestions based on your model designs, see Improve Quick Block Insert Results.

  • To search for a block by name, double-click the canvas and then type the name of a block to get a list of blocks that starts with the characters you typed. For custom library blocks, you can type the block keyword, if the library author assigned one. The list is ranked based on your recent block usage history.

  • To connect one port to multiple blocks, click a port, then hold Shift before you click another port. Holding Shift lets you make multiple, consecutive connections. For example, while holding Shift, you can branch a new signal line and connect it to another port or signal line with one click.

  • To connect blocks, select the first block and Ctrl+click the block you want to connect it to. This technique is useful when you want to connect blocks that have multiple inputs and outputs, such as multiple blocks to a bus or two subsystems with multiple ports. As with clicking two ports, this technique is useful when you do not want to align blocks. The signal line bends as needed to make the connection.

    A selected Gain block connected to a Scope block

    To make a diagonal line from line segments, press Shift and drag a vertex.

    A Gain block connected to a Scope block with diagonal line segments


To improve the shape of a signal line, select the line and pause on the ellipsis that appears. From the action bar, select Auto-route Line. The line redraws if a better route between model elements is possible. To improve line routing for a selected block or for multiple model elements selected by dragging a selection box, select Auto-route Lines from the action bar.

Organize Your Model into Components

You can group blocks in subsystems and label blocks, subsystems, and signals. For more information about subsystems, see Create Subsystems.

  1. Drag a selection box around the Abs block and the Gain block next to it.

  2. Move the cursor over the ellipsis that appears at the corner of the selection box. From the action bar, select Create Subsystem.

    Model with a selection box around the Abs block and the Gain block, the action bar visible, and the cursor hovering over the Create Subsystem button

    A Subsystem block appears in the model in place of the selected blocks. On the Subsystem block icon, labels describe the input and output ports by index or name.

    Build complete


    You can place a port on any side of the Subsystem block. To move a port, click and drag it around the block.

    To resize the Subsystem block for the best fit in your model, drag the block handles.

  3. Give the subsystem a meaningful name. Select the block, double-click the name, and type Absolute Value. Naming a block causes the name to appear in the model.

  4. Open the Absolute Value subsystem by double-clicking it. Alternatively, right-click the subsystem and select Open in New Tab.

    The subsystem contains the blocks and signal that you selected as the basis of the subsystem. They are connected in sequence to two new blocks: an Inport block and an Outport block. Inport and Outport blocks correspond to the input and output ports on the subsystem. Creating the subsystem from a selection that includes a named signal adds the name of the signal to the corresponding Inport or Outport block.

    Contents of subsystem

  5. Click the Up to Parent button to return to the top level of the model.


    You can use the Explorer Bar to navigate the model hierarchy. For example, to return to the parent model, click the name of the parent model.

    The name of the parent model is a button in the Explorer Bar

    The figure shows the model after you create the subsystem and name it.

    Model containing subsystem block with the label Absolute Value underneath it

Related Topics