Configure Model Layout
You can organize block diagrams by changing the position and orientation of model elements.
You can move signal lines by dragging them.
You can move, rotate, and flip blocks.
For some blocks, such as the Subsystem block, you can change the port order.
You can change the block diagram layout manually, or you can have the software can arrange it for you.
For information about how to organize blocks into subsystems, see Group Blocks into Subsystems. For information about how to bundle signal lines, see Group Signals or Messages into Virtual Buses.
Improve Model Layout with Auto Arrange
To improve your diagram layout and appearance, on the Format tab, click Auto Arrange.
Alternatively, press Ctrl+Shift+A.
Aligns blocks in your block diagram from left to right, starting with inputs and ending with outputs
Resizes blocks, such as the Constant block, to display long parameter values
Standardizes block size among similar blocks
Straightens signal lines by moving blocks
You can also auto arrange the block diagram in a model programmatically.
Load the model using the
Auto arrange the block diagram using the
Alternatively, you can try improving the shapes of individual signal lines. Select the signal line and, from the action bar, select Auto-route Line. The line redraws if a better route between model elements is possible.
You can try to improve multiple lines by using Auto-route Lines. To access Auto-route Lines from the action bar, select a block or select multiple model elements by dragging a box around the elements.
Move Multiple Model Elements Simultaneously
To move multiple model elements while maintaining their spatial relationships:
Select the model elements by dragging a selection box around them.
Move the model elements by dragging an edge of the selection box to a new position.
The contents of the selection box move as a unit. The relationship among lines, blocks, and other elements in the selection box remains the same as you move them. Line segments outside of the selection box reroute.
For example, consider this model.
When you drag a selection box that includes line bends, the included line bends remain the same when you move the selection.
When you drag a selection box that excludes line bends, the excluded line bends may change when you move the selection.
To move multiple lines together, drag the selection box around the line segments you want to move.
Flip or Rotate Blocks
You can change the orientation of a block or a group of blocks by rotating blocks in 90-degree increments or by flipping the blocks. Rotating or flipping blocks can help them fit better in the block diagram, such as in feedback loops, where the blocks are connected to each other in a loop. You might also need to rotate a block so that the block input ports align with output ports or to make better use of the model canvas.
The figure shows a Gain block flipped to simplify a feedback loop diagram.
To rotate a block, select the block. On the Format tab, click Rotate 90 clockwise or Rotate 90 counterclockwise .
To rotate a block clockwise, press Ctrl+R.
To rotate a block counterclockwise, press Ctrl+Shift+R
Blocks automatically rotate when you place them on a signal line that has an orientation other than left to right. For example, if the signal goes from bottom to top and you place a block on it, the block rotates to align with the signal.
To flip a block, select the block and, on the Format tab, click Flip left-right or Flip up-down . You can flip a block horizontally or vertically based on the orientation of the block ports. For example, if the ports are on the sides, the block flips left to right.
Alternatively, to flip a block horizontally, press Ctrl+I.
To rotate or flip a group of blocks, select multiple blocks before rotating or flipping them. You can only flip groups of blocks to the left or right.
After you rotate or flip a group of blocks, you can improve the readability of the block diagram by editing the signal lines. The Auto Arrange option might improve the appearance of signals. (For information on rotation with multiple ports, see Identify Port Location on Rotated or Flipped Block.)
For example, suppose you rotate these selected blocks clockwise.
After you rotate the blocks, some model elements might overlap.
With the blocks and signals selected, on the Format tab, click Auto Arrange.
Identify Port Location on Rotated or Flipped Block
Rotating moves block ports from the sides to top and bottom or the reverse, depending on the placement of the ports. The resulting positions of the block ports depend on the block port rotation type.
Rotating can reposition the ports on some blocks to maintain left-to-right or top-to-bottom port numbering order. A block whose ports are reordered after a rotation has the default port rotation type. This policy helps to maintain the left-right and top-down block diagram orientation convention used in control system modeling applications. The figure shows the effect of clockwise rotation on a block with the default port rotation policy.
A masked block can specify that ports keep their order after rotation (see Icon drawing commands). These blocks have a physical port rotation type. This policy helps when designing blocks to use when modeling physical systems and other applications where diagrams do not have a preferred orientation. The figure shows the effect of clockwise rotation on a block with a physical port rotation type.
Flipping a block moves the ports to the opposite side of the block, creating a mirror image, regardless of port rotation type.
You can put ports in any order on any side of these blocks:
Subsystem Reference block
Chart (Stateflow) block
Truth Table (Stateflow) block
State Transition Table (Stateflow) block
You can move ports by clicking and dragging the port.
For Subsystem blocks, the port index will automatically be renumbered after each move. For port label editing on Subsystem blocks, see Edit Port Labels on Subsystems.
You can drag a port to any side of a Subsystem block.
You cannot drag ports on masked or linked Subsystem blocks.