Main Content

Simulink.Mask.copy

Copy a mask from one block to another

    Description

    example

    pSource = Simulink.Mask.get(srcBlockName) gets the mask on the source block specified by srcBlockName as a mask object.

    pDest = Simulink.Mask.create(destBlockName) creates an empty mask on the destination block specified by destBlockName.

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

    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

    Handle to the source block or the path to the source block inside the model is specified as character vector.

    Data Types: char | string

    The handle to the destination block or the path to the destination block inside the model.

    Note

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

    Data Types: char | string

    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