Why the Signal Editor block does not hold the final value in R2020b?

2 views (last 30 days)
I set the signal in Signal Editor to "Holding final value" but it goes back to zero:
What is causing this behavior?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 3 May 2021
The Signal Editor block has signal level settings. The pull-down next to "Active signal" lists all the signals that can be configured. All the signals are initialized to a default configuration. By selecting a particular signal in the pull-down you can see its properties. This is a mechanism that allows this block to output different signals with different properties such as different sample times, units and interpolation, extrapolation settings. The block can also output different buses as you can set different bus objects on different signals.
The issue you are seeing is because "Holding final value" is not set for all the existing signals. There is no other way to set the setting for "all" the signals, other than selecting one Active Signal at a time.
Alternatively, you can use command-line API like below:
sigEditBlk = gcb; %set block handle or blockpath. gcb is simply an example
numCases = str2double(get_param(sigEditBlk,'NumberOfScenarios'));
for sc = numCases:-1:1
  set_param(sigEditBlk, 'ActiveScenario', sc);
  numSignals = str2double(get_param(sigEditBlk,'NumberOfSignals'));
  for sig = numSignals:-1:1
    set_param(sigEditBlk, 'ActiveSignal', sig);
    set_param(sigEditBlk,'OutputAfterFinalValue','Holding final value');
  end
end 

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!