How can I set the "Prompt location" property of a Simulink.MaskParameter programmatically.

The "promp location" of a mask parameter is available through the mask editor window, but the property is not available in the Simulink.MaskParameter class. How can it be set programmatically?
SupportRequest.png

 Accepted Answer

Mask parameter “Prompt Location” can be set programatically using the command ‘p.DialogControl.PromptLocation
Where p is a mask parameter.
Below is an example code
import Simulink.*;
% give the path of the masked block to the get function
a = Simulink.Mask.get('filename/BlockName);
p = a.Parameters(1);
p has following properties
Type: 'edit'
TypeOptions: {0×1 cell}
Name: 'Parameter2'
Prompt: ''
Value: '0'
Evaluate: 'on'
Tunable: 'on'
NeverSave: 'off'
Hidden: 'off'
ReadOnly: 'off'
Enabled: 'on'
Visible: 'on'
ShowTooltip: 'on'
Callback: ''
Alias: ''
DialogControl: [1×1 Simulink.dialog.parameter.Edit]
ConstraintName: ''
p.DialogControl has properties as follows
Name: 'Parameter2'
PromptLocation: 'left'
Row: 'new'
HorizontalStretch: 'on'
Tooltip: ''

4 Comments

Using Matlab 2017b, a.Parameters(1) in this context returns:
MaskParameter with properties:
Type: 'edit'
TypeOptions: {0×1 cell}
Name: 'DF_NONE'
Prompt: 'DF_NONE'
Value: '0'
Evaluate: 'on'
Tunable: 'on'
NeverSave: 'off'
Hidden: 'off'
ReadOnly: 'off'
Enabled: 'on'
Visible: 'on'
ShowTooltip: 'on'
Callback: ''
Alias: ''
As you can see 'DialogControl' is missing.
The above answer was provided using MATLAB 2019a.
Seems that such parameter is not available in MATLAB 2017b.

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Products

Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!