主要内容

本页翻译不是最新的。点击此处可查看最新英文版本。

Simulink.BlockDiagram.arrangeSystem

改进模块图布局

说明

Simulink.BlockDiagram.arrangeSystem(bd) 通过重新对齐、调整大小和移动模块以及拉直信号线来改进指定模块图的布局。

注意

使用任何语法运行 Simulink.BlockDiagram.arrangeSystem 函数都会更改信号线句柄。

示例

Simulink.BlockDiagram.arrangeSystem(bd,FullLayout=tf) 指定是否应用自动布局,即使自动布局可能不会改进原始布局也是如此。

示例

示例

全部折叠

您可以将 Simulink.BlockDiagram.arrangeSystem 用于任何打开的模型,它对于您以编程方式填充的模型特别有用。

模型 ex_arrange_system 中的模块排列不佳。

open_system('ex_arrange_system')

The model contains a Sine Wave block, a Pulse block, a Subsystem block, and a Scope block. The Scope block is on top of the Subsystem block, and none of the blocks are lined up. The Sine Wave and Pulse blocks connect to the Subsystem block, and the Subsystem block connects to the Scope block. The blocks are connected with diagonal signal lines. Two of the signal lines overlap.

其子系统中的模块也排列不佳。

open_system('ex_arrange_system/Subsystem')

The subsystem contains two input port blocks, a Sum block, and an output port block. None of the blocks are lined up. The two input ports connect to the Sum block, and the Sum block connects to the output port block. The blocks are connected with diagonal signal lines. Two of the signal lines overlap.

以编程方式在指定系统的顶层排列模块。

Simulink.BlockDiagram.arrangeSystem('ex_arrange_system')

The blocks in the top layer of the model are neatly arranged, with the Sine Wave and Pulse blocks at the left, the Subsystem block in the middle, and the Scope block on the right. The connecting signal lines are exclusively composed of orthogonal line segments. No blocks or signal lines overlap.

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

The blocks in the subsystem are neatly arranged, with the input port blocks blocks at the left, the Sum block in the middle, and the output port block on the right. The connecting signal lines are exclusively composed of orthogonal line segments. No blocks or signal lines overlap.

默认情况下,Simulink.BlockDiagram.arrangeSystem 仅在自动布局有望改进原始布局时才应用自动布局。即使自动布局可能无法改进原始布局,您也可以强制此函数应用布局。

模型 ForceArrangeSystem 中的模块排列良好。

open_system('ex_arrange_system2')

The model contains a Sine Wave block and a Pulse block that connect to a Subsystem block. The Subsystem block connects to a Scope block. The blocks are neatly arranged, with the Sine Wave and Pulse blocks at the left, the Subsystem in the middle, and the Scope block at the right. The blocks are connected with signal lines that consist exclusively of orthogonal line segments.

自动布局可能不会在原始布局的基础上有所改进,因为模块已排列得很好。

假设您要应用自动化布局,而不管自动化布局是否能带来改进效果。要强制应用自动布局,请将 FullLayout 设置为 true

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

The model has the same layout as before.

输入参数

全部折叠

系统的模块图,指定为字符向量、字符串标量或数值标量。

指定以下选项之一:

  • 系统名称(不能包含路径或扩展名)

  • 系统句柄

  • Subsystem 模块路径

数据类型: double | char | string

强制应用自动布局的选项,指定为 'true''false'

  • 'true' - 应用自动布局,即使自动布局可能无法改进原始布局也是如此

  • 'false' - 仅当自动布局有望改进原始布局时,才应用自动布局。

版本历史记录

在 R2018a 中推出