| Using Simulink | ![]() |
The Parameters Pane
The Parameters pane allows you to create and modify masked subsystem parameters (mask parameters, for short) that determine the behavior of the masked subsystem.
The Parameters pane contains the following elements:
Dialog Parameters Panel
Lists the mask's parameters in tabular form. Each row displays the major attributes of one of the mask's parameters.
Prompt. Text that identifies the parameter on a masked subsystem's dialog box.
Variable. Name of the variable that stores the parameter's value in the mask's workspace (see Mask Workspace). You can use this variable as the value of parameters of blocks inside the masked subsystem, thereby allowing the user to set the parameters via the mask dialog box.
Note
Simulink does not distinguish between uppercase and lowercase letters in mask variable names. For example, Simulink treats gain, GAIN, and Gain as the same name.
|
Type. Type of control used to edit the value of this parameter. The control appears on the mask's parameter dialog box following the parameter prompt. The button that follows the type name in the Parameters pane pops up a list of the controls supported by Simulink (see Control Types). To change the current control type, select another type from the list.
Evaluate. If checked, this option causes Simulink to evaluate the expression entered by the user before it is assigned to the variable. Otherwise, Simulink treats the expression itself as a string value and assigns it to the variable. For example, if the user enters the expression gain in an edit field and the Evaluate option is checked, Simulink evaluates gain and assigns the result to the variable. Otherwise, Simulink assigns the string 'gain' to the variable. See Check Box Control and Pop-Up Control for information on how this option affects evaluation of the parameters.
If you need both the string entered and the evaluated value, clear the Evaluate option. To get the value of a base workspace variable entered as the literal value of the mask parameter, use the MATLAB evalin command in the mask initialization code. For example, suppose the user enters the string 'gain' as the literal value of the mask parameter k where gain is the name of a base workspace variable. To obtain the value of the base workspace variable, use the following command in the mask's initialization code:
Tunable. Selecting this option allows a user to change the value of the mask parameter while a simulation is running.
| Note Simulink ignores this setting if the block being masked is a source block, i.e., the block has outputs but no input ports. In such a case, even if this option is selected, you cannot tune the parameter while a simulation is running. See Changing Source Block Parameters for more information. |
Options for Selected Parameter Panel
This panel allows you to set additional options for the parameter selected in the Dialog parameters table.
Show parameter. The selected parameter appears on the masked block's parameter dialog box only if this option is checked (the default).
Enable parameter. Clearing this option grays the selected parameter's prompt and disables its edit control. This means that the user cannot set the value of the parameter.
Popups. This field is enabled only if the edit control for the selected parameter is a pop-up. Enter the values of the pop-up control in this field, each on a separate line.
Callback. Enter MATLAB code that you want Simulink to execute when a user applies a change to the selected parameter, i.e., selects the Apply or OK button on the mask dialog box. You can use such callbacks to create dynamic dialogs, i.e., dialogs whose appearance changes, depending on changes to control settings made by the user, e.g., enabling an edit field when a user checks a check box (see Creating Dynamic Dialogs for Masked Blocks for more information).
The callback can create and reference variables only in the block's base workspace. If the callback needs the value of a mask parameter, it can use get_param to obtain the value, e.g.,
Parameter Buttons
The following sections explain the purpose of the buttons that appear on the Parameters pane in the order of their appearance from the top of the pane.
Add Button. Adds a parameter to the mask's parameter list. The newly created parameter appears in the adjacent Dialog parameters table.
Delete Button. Deletes the parameter currently selected in the Dialog parameters table.
Up Button. Moves the currently selected parameter up one row in the Dialog parameters table. Dialog parameters appear in the mask's parameter dialog box (see Mask Parameter Dialog Box) in the same order in which they appear in the Dialog parameters table. This button (and the next) thus allows you to determine the order in which parameters appear on the dialog box.
Down Button. Moves the currently selected parameter down one row in the Dialog parameters table and hence down one position on the mask's parameter dialog box.
| The Icon Pane | Control Types | ![]() |
© 1994-2005 The MathWorks, Inc.