select bus elements programmatically
30 views (last 30 days)
Show older comments
Chad Rutherford on 14 Mar 2021
Answered: Uday Pradhan on 17 Mar 2021
I have signals in a SIMULINK bus and I would like to select specific signals from it. The issue is that I want to run an initialization script that will decide which subset of signals to select. I see that you can select bus signals manually via the bus selector block. Is there any way to perform this function programmatically?
Uday Pradhan on 17 Mar 2021
You can select the signals to be passed through the bus selector by using:
%Say we want to choose the signals 1 and 2 to pass through the Bus
%selector, then we can do:
Here gcb contains the name of the block i.e. in my case:
where 'trial' is my model's name. I hope this helps! More information on Bus selector can be found here:Bus selector block (check the Programmatic Use sections)
More Answers (0)
Find more on Signal Attributes and Indexing 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!