How to connect several Simulink blocks to one Simulink Dashboard toggle switch ?
6 ビュー (過去 30 日間)
古いコメントを表示
Dear MathWorks community,
I would like to chnage the value of sereval "constant" simulink blocks by using a single toggle switch from the Dashboard library.
However when I try to connect them, it looks like we are allowed to connect only one block.
Is there any solution to do it ?
Many thanks in advance for your support.
Hadrien
0 件のコメント
回答 (1 件)
Govind KM
2024 年 9 月 26 日
Hi Hadrien,
I was facing a similiar issue. As a workaround, the "Callback Button" from the "Simulink/Dashboard" library can be used to achieve the same effect as a "Toggle Switch" for multiple blocks at once. Here is sample code for the "ClickFcn" callback which checks the current value of "Constant" blocks in the model and toggles values when clicked:
if(get_param('myModel/Constant1','Value')=='10') %Taking random values to be toggled
set_param('myModel/Constant1','Value','2')
set_param('myModel/Constant2','Value','3')
else
set_param('myModel/Constant1','Value','10')
set_param('myModel/Constant2','Value','15')
end
A sample model has been attached for your reference.
Hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Raspberry Pi Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!