Simulink.BlockDiagram.copyContentsToSubSystem

Copy contents of block diagram to empty subsystem

Syntax

Simulink.BlockDiagram.copyContentsToSubSystem(bdiag, subsys)

Description

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

bdiag

Block diagram name or handle

subsys

Subsystem name or handle

Examples

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

open_system('vdp');
new_system('new_model_with_vdp')
open_system('new_model_with_vdp');
add_block('built-in/Subsystem', 'new_model_with_vdp/vdp_subsystem')
Simulink.BlockDiagram.copyContentsToSubSystem...
('vdp', 'new_model_with_vdp/vdp_subsystem')
Was this topic helpful?