Parameters & Dialog Pane

About the Parameters & Dialog Pane

The Parameters & Dialog pane enables you to design rich mask dialog boxes using the dialog controls in the Parameters, Display, and Action palettes.

The Parameters & Dialog pane consists of the following:

  • Controls

    Controls are elements in a mask dialog box that users can interact with to enter or manipulate data. You can add the following dialog controls to a mask dialog box:

    • Parameter

      Parameters are user inputs that take part in simulation. The Parameters palette has a set of parameter dialog controls that you can add to a mask dialog box. See Parameter.

    • Display

      Controls on the Display palette allow you to group dialog controls in the mask dialog box and display text and images. See Display.

    • Action

      Action controls allow you to perform some actions in the mask dialog box. For example, you can click a hyperlink or a button in the mask dialog box. See Action.

  • Dialog box

    You can drag and drop dialog controls from the palettes to the Dialog box to create a mask dialog box. See Dialog box.

  • Property editor

    The Property editor allows you to view and set the properties for the Parameters, Display, and Action controls. See Property editor.

    • Properties

      Defines basic information on all dialog controls, such as Name, Value, Prompt, and Type.

    • Attributes

      Defines how a mask dialog control is interpreted. Attributes are related only to parameters.

    • Dialog

      Defines how dialog controls are displayed in the mask dialog box.

    • Layout

      Defines how dialog controls are laid out on the mask dialog box.

Controls

Parameter

The Parameters palette contains a set of parameters where your users input data for simulation. Each parameter has a sequence number associated with it. The Parameter palette has the following controls:

  • Edit parameter: Allows you to enter a parameter value by typing it into the field.

  • Check box parameter: Accepts a Boolean value.

  • Popup parameter: Allows you to select a parameter value from a list of possible values.

  • Radio button parameter: Allows you to select a parameter value from a list of possible values. All options for a radio button are displayed on the mask dialog.

  • Slider parameter: Allows you to slide to values within a range defined by minimum and maximum values.

  • Dial parameter: Allows you to dial to values within a range defined by minimum and maximum values.

  • Spinbox parameter: Allows you to spin through values within a range defined by minimum and maximum values.

  • DataTypeStr parameter: Enables you to specify a data type for a mask parameter. For more details, see DataTypeStr parameter.

  • Min parameter: Specifies a minimum value for the parameter.

  • Max parameter: Specifies a maximum value for the parameter. If you add a Max parameter after a Min parameter, it appears in the same row in the mask dialog box.

  • Promote parameter: Allows you to selectively promote block parameters from underlying blocks to the mask. Click the Type options field to open the Promoted Parameter Selector dialog box. In this dialog box, you can select the block parameters that you want to promote. Click OK to close it.

  • Promote all: Allows you to promote all underlying block parameters to the mask. When you promote all parameters, the promote operation deletes parameters that have been promoted previously.

You can set the parameter properties from the Property editor.

DataTypeStr parameter.  A data type parameter enables you to specify a data type for a mask parameter. A data type parameter is particularly useful when you include a masked block in a user-defined library. For more information, see Masks on Blocks in User Libraries.

To specify the data type options, click Type options in the Property editor. It opens the Type Options Editor dialog. In the Type options dialog box following tabs appear:

  • Inherit rules — Specify inheritance rules for determining the data types.

  • Built-in types — Specify one or more built-in Simulink® data types, such as double or int8.

  • Fixed-point — Specify the scaling and signed modes for a fixed-point data type.

  • User-defined — Specify a bus or enumerated (enum) data type, or both.

  • Associations — Associate a data type parameter with a Min, Max, and Edit parameter.

The next figure shows a data type control definition for an Output Data Type prompt that allows your masked block users to select any built-in type. To restrict the choices to built-in data types, do not select any check boxes on the Fixed-point and User-defined tabs.

Specifying Inheritance Rules

To specify one or more inheritance rules for the data type control, on the Inherit rules tab, select the appropriate check boxes.

By default, the Inherit rules tab includes two groups of rules:

  • Common Simulink rules

  • Advanced Simulink rules

The Common Simulink rules are inheritance rules that apply to many blocks in the Simulink library. The Advanced Simulink rules are inheritance rules that apply to one or only a few Simulink blocks.

If there are any custom inheritance rules registered on the MATLAB® search path, then the Inherit rules tab also includes a third group of rules: Custom Simulink rules.

Specifying a Fixed-Point Data Type

To specify a fixed-point data type for a parameter:

  1. Select the parameter on the Parameter palette.

  2. In the Type Options Editor, click the Fixed-point tab.

  3. Select the appropriate scaling and signed mode check boxes. If you do not select a mode, then a user cannot choose a fixed-point data type.

  4. Click the Associations tab.

    Your users can use the association when specifying a fixed-point data type. For a value or value range for a signal, the association can help with the selection of the user select the data type with the best precision.

  5. Specify the minimum, maximum, and value for the fixed-point data.

Specifying an Enumerated Data Type

  1. Select the parameter on the Parameter palette.

  2. In the Type Options Editor , click the User-defined tab.

  3. Select the Enumerated check box.

Specifying a Bus Data Type

  1. Select the parameter on the Parameter palette.

  2. In the Type Options Editor , click the User-defined tab.

  3. Select the Bus check box.

If you specify a bus data type as one of the data types that your users can specify in the mask dialog box, then you must add code in the Initialization pane. Add code to handle the way that the DataTypeStr parameter of an underlying block specifies the data type. For more information about adding code to the Initialization pane, see Initialization Pane.

To handle cases where the DataTypeStr parameter of an underlying block specifies the data type by including the mask parameter as a literal (for example, 'outportdatatype'), add code similar to this code:

maskDTPrmString = get_param(gcb, MaskDTPrmName); 
if is_a_bus_type(MaskDTPrmString)
    blockDTPrmString = get_param(BlockUnderMask, BlockDTPrmName);
    set_param(BlockUnderMask, BlockDTPrmName, ...
        ['Bus: blockDTPrmString'];
end

To handle cases where the DataTypeStr parameter of an underlying block defines the data type using bus object specification, add code similar to this code:

maskDTPrmString = get_param(gcb, MaskDTPrmName); 
if ~is_a_bus_type(maskDTPrmString) 
    blockDTPrmString = get_param(BlockUnderMask, BlockDTPrmName);
    set_param(BlockUnderMask, BlockDTPrmName, ...
        remove_bus_colon_prefix(blockDTPrmString));
end

Data Type Evaluation

Simulink enables the Evaluate option for data type controls. You cannot change this setting.

Display

Controls on the Display palette allow you to group dialog controls in the mask dialog box and display text and images. The Display palette has the following controls:

  • Panel: Container for a group of dialog controls. You use a Panel for logical grouping of dialog controls.

  • Group box: Container used for organizing other dialog controls and containers in the mask dialog box.

  • Tab: Tab is used for grouping dialog controls in the mask dialog box. A tab is contained within a tab container. A tab container can have multiple tabs.

  • Text: Text displayed in the mask dialog box.

  • Image: Image displayed in the mask dialog box.

You can set or view the properties for containers from the Property editor.

When you create a new mask, the description group box contains the following two rows that are added to the Dialog box.

PromptNameDescription

%<MaskType>

DescGroupVar

Mask type specifies a title for the group box. The text that you enter in the Mask type field is mapped to %<MaskType>.

%<MaskDescription>

DescTextVar

Mask description specifies information related to the mask. The text you enter in the Mask description field is mapped to %<MaskDescription>.

Action

These controls allow you to perform some actions in the mask dialog box. For example, click on a hyperlink or button on the mask dialog box. The Action palette has the following controls:

  • Hyperlink: Hyperlink text displayed on the mask dialog box.

  • Button: Button controls on the mask dialog box. You can program button for specific actions.

You can set the properties for Action controls from the Property editor.

Dialog box

You can build a hierarchy of dialog controls by dragging them from a palette to the Dialog box. You can also double-click dialog controls on the palettes to add them to the Dialog box. You can have maximum of 32 levels of hierarchy in the Dialog box.

The Dialog box displays three fields: Type, Prompt, and Name.

  • The Type field shows the type of the dialog control and cannot be edited. It also displays a sequence number for parameter dialog controls.

  • The Prompt field shows the prompt text for the dialog control. For label and hyperlink, a default prompt string is provided.

  • The Name field is auto-populated and uniquely identifies the dialog controls.

The Parameter controls are displayed in light blue background whereas the Display and Action controls are displayed in white background on the Dialog box.

Moving dialog controls in the Dialog box

You can move dialog controls up and down in the hierarchy using drag and drop. When you drag a control, a cue line indicates the level in the hierarchy. Based on the type of dialog control, you can drag and drop controls as indicated:

  • Drag and drop on the container dialog control in the Dialog box

    • Drop before it: Adds the dialog control as a sibling before the current dialog control.

    • Drop on it: Adds to the container as a child at the end.

    • Drop after it: Adds the dialog control as a sibling after the current dialog control.

  • Drag and drop on the non-container dialog control in the Dialog box

    • Drop before it: Adds the dialog control before the current dialog control.

    • Drop after it: Adds the dialog control after the current dialog control.

  • Drag and drop into Dialog box blank area

    • The element is added to the root level node.

Cut, Copy, and Paste Controls

You can cut, copy, and paste dialog controls on the Dialog box using the context menu.

Delete nodes

Right-click the control that you want to delete in the Dialog box. Select, from the context menu. For example, to delete a Check box dialog control, right-click and select Delete:

You can also use the Delete menu option to delete a dialog control.

Error Display

If you have errors in parameters names, such as, duplicate, invalid parameter names, or empty names, the mask editor displays the parameter names in red outline. When you edit the parameters to fix errors, the modified fields are identified by a yellow background.

  1. Duplicate Parameter, Display, and Action control names are not allowed.

  2. Parameter names must be unique and are case insensitive. Names varying only in lowercase and uppercase letters, are treated as duplicates. For example, Parameter1 and parameter1 are not allowed.

  3. Parameter , Display, and Action control names can be same as long as different lowercase and uppercase characters are used. For example, while a and A are allowed, b and b are not allowed.

  4. Action and Display control names are case sensitive. For example, while Control3 and control3 are allowed, control3 and control3 are not allowed.

Property editor

The Property editor allows you to view and set the properties for Parameter, Display, and Action dialog controls. The Property editor for Parameter is shown below:

Properties

You can set the following properties for Parameter, Action, and Display dialog controls:

  • Name

    Uniquely identifies the dialog control in the mask dialog box. The Name property must be set for all dialog controls.

  • Value

    Value of the Parameter dialog control. The Value property applies only to the Parameter dialog controls.

  • Prompt

    Label text that identifies the parameters in a mask dialog box. The Prompt property applies to all dialog controls except Panel and Image dialog control.

  • Type

    Type of the dialog control. You can change the Type field only for the Parameter dialog controls.

  • Type options

    The Type options property allows you to set specific Parameter properties. The Type options property applies to the Popup, Radio button, DataTypeStr, and Promoted parameters.

  • File path

    You can add an image to a mask using the Image dialog control. You can also display an image on a Button dialog control. In either case, provide the path to the image in the File path property that is enabled for these two dialog controls. For the Button dialog control, specify an empty string for the Prompt property in order for the image to be displayed.

  • Word wrap

    The Word wrap property enables word wrapping for long text. The Word wrap property applies only for Text dialog control.

Attributes

You can set the following attributes for Parameter and Action dialog controls:

  • Evaluate

    Simulink uses the value of a mask parameter as the user enters it in the mask dialog box, or it can evaluate what your user specify and use as the result of the evaluation. Select the Evaluate option for a parameter to specify parameter evaluation (the default). Clear the option to suppress evaluation.

  • Tunable

    By default, your masked block users can change a mask parameter value during simulation. Clear the Tunable option to prohibit changing the parameter value during simulation. If the masked block does not support parameter tuning, Simulink ignores the Tunable option setting of a mask parameter. For information about parameter tuning and the blocks that support it, see Tunable Parameters.

  • Read only

    Indicates that the parameter cannot be modified.

  • Hidden

    Indicates that the parameter must not be displayed in the mask dialog box.

  • Never save

    Indicates that the parameter value never gets saved in the model file.

Dialog box

You can set the following Dialog properties for the Parameter and Display dialog controls:

  • Enable

    Clearing this option makes the selected parameter prompt unavailable and disables its edit control. Your masked block users cannot set the value of the parameter.

  • Visible

    The selected parameter appears in the mask dialog box only if this option is selected.

  • Callback

    MATLAB code that you want Simulink to execute when a user applies a change to the selected parameter.

Layout

You can set the location and alignment of the dialog controls in the mask dialog box as follows:

  • Item location

    Allows you to set the location for the dialog control to appear in the current row or a new row.

  • Prompt location

    Allows you to set the prompt location for the dialog control on either the top or to the left of the dialog control.

  • Orientation

    Allows you to specify horizontal or vertical orientation for sliders and radio buttons.

You cannot set the Prompt location property for Check box, Dial, DataTypeStr, and Radiobutton.

Was this topic helpful?