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

2 次查看(过去 30 天)
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

采纳的回答

Kushagr Gupta
Kushagr Gupta 2016-11-8
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!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by