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

50 views (last 30 days)
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.

Accepted Answer

Sebastian Castro
Sebastian Castro on 29 Apr 2015
Edited: Sebastian Castro on 29 Apr 2015
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 Comments
T PRABHU
T PRABHU on 19 May 2018
If more than one bus selector block is used in model how to select particular bus selector through command
Ebuka
Ebuka on 22 Nov 2022
Now how do i add just 4 Output signals using simuliink only please this is urgent

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!