Main Content

Simulink.BlockDiagram.arrangeSystem

Improve layout of block diagram

Description

Simulink.BlockDiagram.arrangeSystem(bd) improves the layout of the specified block diagram by realigning, resizing, and moving blocks and straightening signal lines.

Note

Running the Simulink.BlockDiagram.arrangeSystem function with any syntax changes the line handles.

example

Simulink.BlockDiagram.arrangeSystem(bd,FullLayout=tf) specifies whether to apply the automated layout even when the automated layout might not improve upon the original layout.

example

Examples

collapse all

You can use Simulink.BlockDiagram.arrangeSystem with any open model, and it is particularly useful with models you populate programmatically.

Blocks in the model ex_arrange_system are poorly arranged.

open_system('ex_arrange_system')

Blocks in its subsystem are also poorly arranged.

open_system('ex_arrange_system/Subsystem')

Programmatically arrange blocks in the top layer of the specified system.

Simulink.BlockDiagram.arrangeSystem('ex_arrange_system')

Simulink.BlockDiagram.arrangeSystem('ex_arrange_system/Subsystem')

By default, Simulink.BlockDiagram.arrangeSystem applies an automated layout only when the automated layout is expected to improve upon the original layout. You can force this function to apply the layout even when the automated layout might not improve upon the original layout.

Blocks in the model ForceArrangeSystem are arranged well.

open_system('ex_arrange_system2')

The automated layout might not improve upon the original layout because the blocks are already arranged well.

Suppose you want to apply the automated layout regardless of whether the automated layout is an improvement. To force the automated layout, set FullLayout to true.

Simulink.BlockDiagram.arrangeSystem('ex_arrange_system2',FullLayout='true')

Input Arguments

collapse all

Block diagram of system, specified as a character vector, string scalar, or numeric scalar.

Specify one of the following options:

  • System name (must not include a path or extension)

  • System handle

  • Subsystem block path

Data Types: double | char | string

Option to force automated layout, specified as 'true' or 'false'.

  • 'true' — Applies the automated layout even when the automated layout might not improve upon the original layout

  • 'false' — Applies the automated layout only when the automated layout is expected to improve upon the original layout.

Version History

Introduced in R2018a