Azzera filtri
Azzera filtri

How can I select the output of WaveFormGenerator Simulink block from a script?

1 visualizzazione (ultimi 30 giorni)
Hello,
I am using the block WaveFormGenerator from simulink, I see that the Output Signal can be selected during the simulation according to the documentation, so I was wondering whether or not it is possible to select that output from a initial script that will launch my simulation.
Any suggestions if this is achievable?
Thanks in advance,
REgards

Risposta accettata

Kushagr Gupta
Kushagr Gupta il 8 Nov 2016
I understand that the Programmatic (command-line) way to select a signal output of a WaveFormGenerator is being asked for.
It is possible to select signals before the simulation starts and after a simulation has ended but not during the time when simulation is running.
By using the 'get_param' one can change and select signals as required. Following is a code snippet on how to do so:
>> WaveFormBlk = gcb %path to the WaveformGenerator block in model (Can select the block and use gcb or give the ExactPath to the block as a string)
>> get_param(WaveFormBlk,'selectedSignal')
% returns the present selected signal
>> set_param(WaveFormBlk,'selectedSignal','4')
% Change the selection to 4, Third argument has to be a string containing a number representing which signal to select
Hope this helps!

Più risposte (0)

Categorie

Scopri di più su Programmatic Model Editing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by