select bus elements programmatically

51 Ansichten (letzte 30 Tage)
Chad Rutherford
Chad Rutherford am 14 Mär. 2021
Beantwortet: Uday Pradhan am 17 Mär. 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?

Akzeptierte Antwort

Uday Pradhan
Uday Pradhan am 17 Mär. 2021
Hi,
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:
set_param(gcb,'OutputSignals','signal1,signal2')
Here gcb contains the name of the block i.e. in my case:
>> gcb
ans =
'trial/Bus Selector'
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)

Weitere Antworten (0)

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by