Main Content

Simulink.SubSystem.copyContentsToBlockDiagram

Copy graphical contents from subsystem to empty system

Description

example

Simulink.SubSystem.copyContentsToBlockDiagram(subsys,sys)copies the blocks, lines, and annotations of the specified subsystem to the top-level block diagram of the specified system. It does not affect nongraphical information such as configuration sets.

To use this function:

  • The specified system must be loaded in memory.

  • The specified subsystem must be loaded in memory.

  • The specified system must not contain any blocks or lines. Other types of information can exist in the system and are unaffected by the function. To delete the graphical content of the system, useSimulink.BlockDiagram.deleteContents.

Examples

collapse all

Copy the graphical contents of a subsystem to a new model.

Open thef14model.

open_system('f14');

Create an empty model namedf14Controller.

model = new_system(“f14Controller”); open_system(model)

Copy the graphical contents from thef14/Controllersubsystem to the emptyf14Controllermodel.

Simulink.SubSystem.copyContentsToBlockDiagram('f14/Controller', model)

Input Arguments

collapse all

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

Example:'model1/Subsystem'

Data Types:double|char|string

System name or handle, specified as a character vector, string scalar, or numeric scalar.

A system name must not include a path or extension.

Example:'model2'

Data Types:double|char|string

Tips

To flatten a model hierarchy by replacing a subsystem with its contents, use theSimulink.BlockDiagram.expandSubsystemfunction.

Version History

Introduced in R2007a