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

4 vues (au cours des 30 derniers jours)
Dhines
Dhines le 9 Déc 2022
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

Réponses (1)

Rajanya
Rajanya le 25 Sep 2024
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!

Catégories

En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by