How to access Bus Ports parameter from action bar in Buscreator/Busselector blocks?

3 ビュー (過去 30 日間)
Dhines
Dhines 2022 年 12 月 9 日
回答済み: Rajanya 2024 年 9 月 25 日
When programmatically change bus selector/bus creator block to bus element port block through clicking by option from action bar "Bus Ports"? How can I programmatically do this in matlab?
for exampe from first image comment.png to access comment out parameter using get(gcbh,'commented');
same what parameter name to access busports ? --->from second image busports.png

回答 (1 件)

Rajanya
Rajanya 2024 年 9 月 25 日
I understand that you want to access and control the ‘Bus ports’ parameter from action bar in a ‘Bus Creator/ Bus Selector’ programmatically.
The number of input ports can be initialized using the ‘Number of inputs’ parameter in a ‘Bus Creator’. The following lines of code can be used to set and get the input parameter of a ‘Bus Creator’ programmatically.
set_param(gcb,'Inputs','element1,element2,element3,element4')
get(gcbh,"Inputs")
The ‘set_param’ sets the input parameters and the incoming elements to the bus, thereby varying the number of input ports. The ‘get’ method called on the ‘current block handle’, indicated by ‘gcbh’, gives us the current number of input ports of the ‘Bus Creator’.
For more information about the parameters of a ‘Bus Creator block’, refer this documentation page: https://www.mathworks.com/help/releases/R2020b/simulink/slref/buscreator.html#mw_0b4c698d-d93d-4b10-8bca-8ae11894f317
Hope this helps!

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by