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?

4 次查看(过去 30 天)
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.

回答(1 个)

Fangjun Jiang
Fangjun Jiang 2019-9-16
"abc" marks the string data type, which is introducted in R2016b. You can just use 'Binding' in R2015b.
  3 个评论
Fangjun Jiang
Fangjun Jiang 2019-9-17
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 2019-9-17
编辑:Arun Joe Joseph 2019-9-17
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Control Simulations with Interactive Displays 的更多信息

产品


版本

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by