This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Copy contents of block diagram to empty subsystem


Simulink.BlockDiagram.copyContentsToSubsystem(bdiag, subsys)


Simulink.BlockDiagram.copyContentsToSubsystem(bdiag, subsys) copies the contents of the block diagram bdiag to the subsystem subsys. The block diagram and subsystem must have already been loaded. The subsystem cannot be part of the block diagram.

The function affects only blocks, lines, and annotations; it does not affect nongraphical information such as configuration sets. You can use this function to convert a referenced model derived from an atomic subsystem into an atomic subsystem that is equivalent to the original subsystem.

This function cannot be used if the destination subsystem contains any blocks or signals. Other types of information can exist in the destination subsystem and are not affected by the function. Use Simulink.SubSystem.deleteContents if necessary to empty the subsystem before using Simulink.BlockDiagram.copyContentsToSubsystem.

Input Arguments


Block diagram name or handle


Subsystem name or handle


Copy the contents of vdp to an empty subsystem named vdp_subsystem that is in the model named new_model_with_vdp:

add_block('built-in/Subsystem', 'new_model_with_vdp/vdp_subsystem')
('vdp', 'new_model_with_vdp/vdp_subsystem')

Introduced in R2007a