Add signals to Selected signal list of a bus selector block by m script
50 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
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
More Answers (0)
See Also
Categories
Find more on Signals in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!