|On this page…|
You can have the Simulink® software connect blocks automatically. This eliminates the need to draw the connecting lines yourself. When connecting blocks, Simulink routes the lines around intervening blocks to avoid cluttering the diagram.
When connecting two blocks with multiple ports, Simulink draws as many connections as possible between the two blocks.
To autoconnect two blocks:
The source block is connected to the destination block, and the lines are routed around intervening blocks if necessary.
To connect a group of source blocks to a destination block:
To connect a source block to a group of destination blocks:
You can draw lines manually between blocks or between lines and blocks. You might want to do this if you need to control the path of the line or to create a branch line.
The cursor shape changes to crosshairs.
The arrow appears at the appropriate input port, and the signal is the same.
A branch line is a line that starts from an existing line and carries its signal to the input port of a block. Both the existing line and the branch line represent the same signal. Use branch lines to connect a signal to more than one block.
This example shows how to connect the Product block output to both the Scope block and the To Workspace block.
To add a branch line:
Line segments differently than autoconnect feature draws the lines
A line, before you copy the block to which the line connects
Draw a line from the block port to an unoccupied area of the canvas. Release the mouse button where you want the line segment to end.
The cursor turns into a circle, and blue arrow guides appear.
For each additional line segment, position the cursor over the blue arrow guide that points in the direction in which you want to draw a line segment. The cursor turns into an empty arrowhead.
Drag the cursor to draw the second line segment and release the mouse button to finish drawing the line.
You cannot draw a single diagonal line between two ports. You can draw very short line segments connecting to each port, with a longer diagonal segment in the middle. For example, suppose you position two blocks as shown below:
To approximate a diagonal line:
Draw a short line segment from the output port of the Constant block.
At the end of the first line segment, draw a second line segment.
Draw a third line segment to connect to the Scope block.
Position the cursor at the bend of the second and third line segments. The cursor turns into a circle.
Hold the Shift key down and drag the cursor to make the second line segment a diagonal.
The cursor changes to a circle.
You can insert a block in a line, if the block has only one input and one output.