Simulink.BlockDiagram.copyContentsToSubSystem - Copy contents of block diagram to empty subsystem

Syntax

Simulink.BlockDiagram.copyContentsToSubSystem(bdiag, subsys)

Arguments

bdiag

Block diagram name or handle

subsys

Subsystem name or handle

Description

Simulink.BlockDiagram.copyContentsToSubSystem 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.

Limitation

Simulink.BlockDiagram.copyContentsToSubSystem 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.

Example

If two block diagrams exist, f14 and f16, and f16 contains an empty subsystem named f14cp, the following code copies the contents of f14, including all nested subsystems, to f16/f14cp. Nongraphical information in f14 is not copied.

% open f14 and f16
open_system('f14');
open_system('f16');

% copy the block diagram f14 to an empty subsystem of f16 named f14cp
Simulink.BlockDiagram.copyContentsToSubsystem('f14', 'f16/f14cp');

% close f14 and f16
close_system('f14', 0);
close_system('f16', 0);

See Also

Simulink.BlockDiagram.deleteContents

Simulink.SubSystem.convertToModelReference

Simulink.SubSystem.copyContentsToBlockDiagram

Simulink.SubSystem.deleteContents

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS