Expand Subsystem Contents

Expand a subsystem to flatten a model hierarchy by bringing the contents of a subsystem up one level.

Expand a Subsystem

  1. In the Simulink® Editor, right-click the Subsystem block for the subsystem that you want to expand.

  2. From the context menu, select Subsystem & Model Reference > Expand Subsystem.

    Expand Subsystem is disabled for subsystems that you cannot convert. For some kinds of subsystems, you have the option of having Simulink modify the subsystem so that you can then expand it. For details, see Subsystems That You Can Automatically Modify to Enable Expansion.

  3. If necessary, modify the model layout for readability.

    Simulink distributes blocks and routes signals for readability, but you can refine the model layout to enhance readability. Also, you may want to modify the model to adjust for how the subsystem expansion handles aspects of the model such as signal naming. For details, see Results of Expanding a Subsystem.

  4. Update scripts and test harnesses that rely on the hierarchical paths to blocks that were in the subsystem that you expanded.

Nested Subsystems

Subsystem expansion applies to the currently selected subsystem level. Simulink does not expand other subsystems in a nested subsystem hierarchy.

To improve readability when you expand nested subsystems, start by expanding the highest-level subsystem that you want to expand, and then work your way down the hierarchy as far as you want to expand.

Expand a Subsystem from the Command Line

To expand a subsystem programmatically, use the Simulink.BlockDiagram.expandSubsystem function.

Related Topics