Skip to Main Content Skip to Search
Product Documentation

Understanding Mask Code Execution

Partitioning MATLAB Code

You can specify MATLAB code for masked blocks in both the mask initialization code and in the block icon drawing code. The location of code affects model performance. In general, partition your code to reflect the functionality you need.

Drawing Commands Execution

Simulink executes the drawing commands in the Drawing Commands pane in the sequence in which the commands appear whenever the block has to be drawn or redrawn.

Initialization Command Execution

When you open a model, initialization commands execute for masked blocks that are visible because they reside at the top level of the model or in an open subsystem and that meet either of the following conditions:

A simple masked block that has initialization commands but no icon drawing commands does not execute the initialization commands when you open the model.

Initialization commands for masked blocks that are not initially visible execute when you open the subsystem or model that contains the blocks.

When you load a model into memory without displaying the model graphically, no initialization commands initially run for any masked blocks. See Loading a Model and load_system for information about loading a model without displaying it.

Initialization commands for all masked blocks in a model that have drawing commands run when you:

Initialization commands for an individual masked block run when you:

Mask Parameters Dialog Box Callback Code Execution

Simulink executes the callback commands when you:

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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