Using Simulink | ![]() ![]() |
Prompts and Associated Variables
A prompt provides information that helps the user enter or select a value for a block parameter. Prompts appear on the mask dialog box in the order they appear in the Prompt list.
When you define a prompt, you also specify the variable that is to store the parameter value, choose the style of control for the prompt, and indicate how the value is to be stored in the variable.
If the Assignment type is Evaluate, the value entered by the user is evaluated by MATLAB before it is assigned to the variable. If the type is Literal, the value entered by the user is not evaluated, but is assigned to the variable as a string.
For example, if the user enters the string gain
in an edit field and the Assignment type is Evaluate, the string gain
is evaluated by MATLAB and the result is assigned to the variable. If the type is Literal, the string is not evaluated by MATLAB so the variable contains the string 'gain'
.
If you need both the string entered as well as the evaluated value, choose Literal. Then use the MATLAB eval
command in the initialization commands. For example, if LitVal
is the string 'gain'
, then to obtain the evaluated value, use the command
value = eval(LitVal)
In general, most parameters use an Assignment type of Evaluate.
Creating the First Prompt
To create the first prompt in the list, enter the prompt in the Prompt field, the variable that is to contain the parameter value in the Variable field, and choose a control style and an assignment type.
Inserting a Prompt
To insert a prompt in the list:
Editing a Prompt
Deleting a Prompt
To delete a prompt from the list:
Moving a Prompt
![]() | The Initialization Pane | Control Types | ![]() |