Main Content

Simulink.BlockDiagram.expandSubsystem

Replace subsystem with subsystem contents

Description

Simulink.BlockDiagram.expandSubsystem(subsys) replaces the specified subsystem with its contents in the block diagram that contains it. The file that contains the subsystem must be open or loaded.

You can expand virtual subsystems that are not masked, linked, or commented. For details, see What Subsystems Can You Expand?.

example

Simulink.BlockDiagram.expandSubsystem(subsys,'CreateArea',specifier) provides the option of not creating an area around the expanded subsystem contents.

example

Examples

collapse all

Replace a subsystem with its contents.

Open the example model, which contains a subsystem that separates functionally related blocks.

open_system('SubsystemExpansionModel')

Expand the subsystem.

Simulink.BlockDiagram.expandSubsystem('SubsystemExpansionModel/Subsystem')

An area that contains the subsystem contents replaces the Subsystem block.

Replace a subsystem with its contents without creating an area that surround the contents.

Open the example model, which contains a subsystem that separates functionally related blocks.

open_system('SubsystemExpansionModel')

Expand the subsystem.

Simulink.BlockDiagram.expandSubsystem(...
    'SubsystemExpansionModel/Subsystem','CreateArea','Off')

The subsystem contents replace the Subsystem block.

Input Arguments

collapse all

Subsystem block path or handle, specified as a character vector, string scalar, or numeric scalar.

Data Types: double | char | string

Option to create area around contents, specified as 'on' to create the area or 'off' to not create the area.

Data Types: char | string

Version History

Introduced in R2014a