Main Content

copy

Class: Simulink.Mask
Namespace: Simulink

Copy mask from one block to another

Syntax

pDest.copy(pSource)

Description

pDest.copy(pSource) overwrites the destination mask with the source mask.

To get the mask on the source block srcBlockName, use this command.

pSource = Simulink.Mask.get(srcBlockName)

To create an empty mask on the destination block destBlockName, use this command.

pDest = Simulink.Mask.create(destBlockName)

Input Arguments

expand all

Mask object of the source block.

Note

The destination block should have an empty mask. Otherwise, the copied mask will overwrite the non-empty mask.

Data Types: char | string

Examples

expand all

Step 1: Create an empty mask on the destination block using the block’s path.

new_system('mymodel');
add_block('built-in/subsystem','mymodel/subsystem');
open_system('mymodel');
pDest=Simulink.Mask.create('mymodel/subsystem');

Step 2: Get source mask as an object using the source block’s path.

add_block('built-in/gain','mymodel/gain');
Simulink.Mask.create('mymodel/gain');
pSource = Simulink.Mask.get('mymodel/gain');

Step 3: Make the destination mask a copy of the source mask.

pDest.copy(pSource);
save_system;

Version History

Introduced before R2006a