How Do I connect Dashboard block to a constant block using command line.

4 ビュー (過去 30 日間)
Pratik Bora
Pratik Bora 2018 年 9 月 28 日
回答済み: Jesús Zambrano 2019 年 12 月 22 日
I want to Simulate value of an input port using dashboard block e.g. Slider. I want to connect Slider block to a constant block. So if I change the value in slider, that will reflect to constant block, connected to the input port. I want to connect this slider block to the constant block using command line function. Is it possible?
  1 件のコメント
Arun Joe Joseph
Arun Joe Joseph 2019 年 9 月 18 日
Hi Pratik,
Did you figure out the answer to this question, yet? If so, could you please share it? I would like to know the solution too.
I have asked a similar question, here:

サインインしてコメントする。

回答 (1 件)

Jesús Zambrano
Jesús Zambrano 2019 年 12 月 22 日
Hi Pratik,
You can find the step to connect dashboards block in the link below fomr the documentation:
In there you will see that you need to work with a Simulink.HMI.ParamSourceInfo object. Here I copy the specific workflow:
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 Mu block. 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)
To remove the connection, do:
set_param('vdp/Slider',"Binding",[])
Hope it can help you.
Best,
Jesús

カテゴリ

Help Center および File ExchangeDashboard についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by