Main Content

Simulink.BlockDiagram.copyContentsToSubsystem

Copy graphical contents from system to empty subsystem

Description

example

Simulink.BlockDiagram.copyContentsToSubsystem(sys,subsys)copies the blocks, lines, and annotations of the specified system to the specified subsystem. It does not affect nongraphical information such as configuration sets.

Use this function to convert a referenced model derived from an atomic subsystem into an atomic subsystem that is equivalent to the original subsystem.

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 the specified subsystem.

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

Examples

collapse all

Copy the contents of a referenced model to an empty subsystem.

Open thesldemo_mdlref_basicmodel.

openExample('sldemo_mdlref_basic')

Add an empty subsystem to the model.

add_block('built-in/Subsystem','sldemo_mdlref_basic/Subsystem')

Load thesldemo_mdlref_counterreferenced model that contains the contents to copy.

load_system('sldemo_mdlref_counter')

Copy the graphical contents from thesldemo_mdlref_counterreferenced model to the empty subsystem.

Simulink.BlockDiagram.copyContentsToSubsystem...('sldemo_mdlref_counter','sldemo_mdlref_basic/Subsystem')

Input Arguments

collapse all

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

The system name must not include a path or extension.

Example:'model1'

Data Types:double|char|string

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

Example:'model2/Subsystem'

Data Types:double|char|string

版本嗨story

Introduced in R2007a