How can we set parameter values like Minimum or Maximum for a Slider and bind it to a tunable block like a Constant, using matlab commands?

6 views (last 30 days)
In Matlab 2015B, working on simulink Dashboard elements, how can we set parameter values like Minimum or Maximum for a Slider and bind the Slider to a tunable block like a Constant, using matlab commands?
I tried using the steps in this link:
Given below is an example snippet from this link:
----------------------------------------------------------------------------------------------------------
Connect and Configure the Slider Block
Use a Simulink.HMI.ParamSourceInfo object and the set_param function to connect the Slider block to the Gain parameter of the Mublock. To connect a parameter, the Simulink.HMI.ParamSourceInfo needs to specify the block path for the block that corresponds to the parameter and the name of the parameter.
slider_param = Simulink.HMI.ParamSourceInfo;
slider_param.BlockPath = Simulink.BlockPath('vdp/Mu');
slider_param.ParamName = 'Gain';
set_param('vdp/Slider',"Binding",slider_param)
Configure the scale for the slider for a range of 1 to 10 with a tick mark spacing of 1.
slider_limits = [1 1 10];
set_param('vdp/Slider',"Limits",slider_limits)
----------------------------------------------------------------------------------------------------------
In the above example, The set_param statements setting the "Binding" or "Limits" parameters do not work for me and result in the following error:
MWDashboardBlock block (mask) does not have a parameter named 'Binding'
MWDashboardBlock block (mask) does not have a parameter named 'Limits'
How do I get these set_param statements to work? Also, I do not understand the reason for usage of double quotes in setting the "Binding" and "Limits" parameters.
If the above example is incompatible with Matlab 2015B, then what would be an alternative method in Matlab 2015B to set parameter values like Minimum or Maximum for a Slider and bind it to a tunable block like a Constant, using matlab commands? I have not yet found a different example that illustrates this.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 16 Sep 2019
"abc" marks the string data type, which is introducted in R2016b. You can just use 'Binding' in R2015b.
  3 Comments
Fangjun Jiang
Fangjun Jiang on 17 Sep 2019
The example in your link is for later versions (R2019a or R2019b). Sometimes there are incompatibilities between versions. That is all.
Arun Joe Joseph
Arun Joe Joseph on 17 Sep 2019
Edited: Arun Joe Joseph on 17 Sep 2019
Thanks, Fangjun. If the above example is incompatible with Matlab 2015B, then what would be an alternative method in Matlab 2015B to set parameter values like Minimum or Maximum for a Slider and bind it to a tunable block like a Constant, using matlab commands? I have not yet found a different example that illustrates this.
I have edited the original question to bring more clarity to the problem. I would be grateful if anyone could help solve this.

Sign in to comment.

Categories

Find more on Control Simulations with Interactive Displays in Help Center and File Exchange

Products


Release

R2015b

Community Treasure Hunt

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

Start Hunting!