Main Content

Simulink.Mask.copy

Copy a mask from one block to another

    Description

    example

    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)

    Examples

    collapse 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;

    Input Arguments

    collapse 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

    Version History

    Introduced in R2006a