Skip to Main Content Skip to Search
Product Documentation

Initialization Pane

About the Initialization Pane

The Initialization pane allows you to enter MATLAB commands that initialize the masked subsystem.

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:

The Initialization pane contains the controls described in this section.

Dialog variables

The Dialog variables list displays the names of the variables associated with the subsystem's mask parameters, which are defined in the Parameters pane. You can copy the name of a parameter from this list and paste it into the adjacent Initialization commands field, using the Simulink keyboard copy and paste commands. You can also use the list to change the names of mask parameter variables. To change a name, double-click the name in the list. An edit field containing the existing name appears. Edit the existing name and click Enter or click outside the edit field to confirm your changes.

Initialization commands

Enter the initialization commands in this field. You can enter any valid MATLAB expression, consisting of MATLAB functions and scripts, operators, and variables defined in the mask workspace. Initialization commands run in the mask workspace, not the base workspace. Terminate initialization commands with a semicolon to avoid echoing results to the MATLAB Command Window.

Allow library block to modify its contents

This check box is enabled only if the masked subsystem resides in a library. Checking this option allows the block's initialization code to modify the contents of the masked subsystem by adding or deleting blocks and setting the parameters of those blocks. Otherwise, an error is generated when a masked library block tries to modify its contents in any way. To set this option at the MATLAB prompt, select the self-modifying block and enter the following command.

set_param(gcb, 'MaskSelfModifiable', 'on');

Then save the block.

Initialization Command Limitations

Mask initialization commands must observe the following rules:

  


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