Using Simulink    

The Initialization Pane

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

Simulink executes the initialization commands when it

The Initialization pane includes the following controls.

Dialog variables

The Dialog variables list displays the names of the variables associated with the subsystem's mask parameters, i.e., the parameters 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 Simulink's 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 existing name and press 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, operators, and variables defined in the mask workspace. Initialization commands cannot access base workspace variables. Terminate initialization commands with a semicolon to avoid echoing results to the 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 block allows the block's initialization code to modify the contents of the masked subsystem, i.e., it lets the code add or delete blocks and set the parameters of those blocks. Otherwise, Simulink generates an error 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.

Then save the block.

Debugging Initialization Commands

You can debug initialization commands in these ways:


  Control Types The Documentation Pane