Contenu principal

Simulink.BlockDiagram.arrangeSystem

R2026b

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.

If the model is open when you run the function, in addition to improving the layout, the function also changes the zoom to fit the block diagram in the model window. If the model is loaded but not open, the function still improves the layout, but does not change the zoom.

Note

Running this function with any syntax changes the line handles.

example

Simulink.BlockDiagram.arrangeSystem(bd,FullLayout=tf) specifies whether to apply the automated layout regardless of whether it improves on the original layout.

Examples

collapse all

Suppose you programmatically create a model named myModel. The model contains a Subsystem block named mySubsystem.

Open the model.

open_system("myModel");

Improve the layout of only the top level of the model.

Simulink.BlockDiagram.arrangeSystem("myModel");

Since the model is open, the zoom of the top level of the model adjusts to fit the block diagram in the model window. The layout and zoom of the subsystem do not change.

Improve the layout of only the subsystem.

Simulink.BlockDiagram.arrangeSystem("myModel/mySubsystem");

Since the model is open, the zoom of the subsystem adjusts to fit the block diagram in the model window. The layout and zoom of the top level of the model do not change.

Input Arguments

collapse all

Model or subsystem containing the block diagram that you want to arrange. Specify a model as a handle or name. Specify a subsystem as the handle or path of the corresponding Subsystem block. Format a handle as a numeric scalar. Format a name or path as a string or character vector. Do not include extensions in a name or path.

For information about getting handles and paths, see Get Handles and Paths.

Example: "myModel"

Example: "myModel/mySubsystem"

Data Types: double | string | character vector

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.

Data Types: string | character vector

Version History

Introduced in R2018a