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

4 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Programmatic Model Editing 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by