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

1 view (last 30 days)
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

Accepted Answer

Kushagr Gupta
Kushagr Gupta on 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!

More Answers (0)

Categories

Find more on Programmatic Model Editing 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!