Add signals to Selected signal list of a bus selector block by m script

I have a bus selector in which there are 10 signals already selected as outputsignals.I want to select a 11 th signal to the selected signals.How this can be done using ma script.
Note : I done want to collect the initial 10 signals which are already selected and create a list with extra signal to be added(1 signal) that makes 11 signal list and use the below command to select all 11 signals. set_param(my_bus_selector,'OutputSignals',a);
I want to add the 11th signal with the already existing 10 signals.
Thanks.

 Réponse acceptée

You can use get_param and set_param on the block's "OutputSignals" parameter to make these modifications programmatically.
For example, take a look below. "gcb" denotes the currently selected block; you could use the explicit block name as a string if you wanted to.
First, get the original signals in the Bus Selector block.
>> origSignals = get_param(gcb,'OutputSignals')
origSignals =
s1,s2
At this point, you can concatenate the existing string with the remaining signal(s) you want to add.
>> newSignals = [origSignals ',s3,s4']
newSignals =
s1,s2,s3,s4
Then, reassign the new string back to the block.
>> set_param(gcb,'OutputSignals',newSignals)
>> get_param(gcb,'OutputSignals')
ans =
s1,s2,s3,s4
- Sebastian

2 commentaires

If more than one bus selector block is used in model how to select particular bus selector through command
Now how do i add just 4 Output signals using simuliink only please this is urgent

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Simulink dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by