Remove trigger from signal in the Simulation Data Inspector
Simulink.sdi.removeTrigger removes the trigger from a signal in the
Simulation Data Inspector. If a trigger exists in the Simulation Data Inspector, adding a
trigger to a different signal also removes the existing trigger.
Programmatically Configure Triggers in the Simulation Data Inspector
Add a trigger to a signal in the Simulation Data Inspector to specify criteria that determine when to update plots to display fresh data. Triggers can allow you to capture transient signal behavior and can help stabilize the display of periodic signals so you can take measurements.
Triggers model. Data in the model logs to the Simulation Data Inspector.
open_system('Triggers'); out = sim('Triggers');
Then, add a trigger to the
Pulse signal. Configure the trigger as a falling-edge trigger with a threshold of
trigRun = Simulink.sdi.getCurrentSimulationRun('Triggers'); pulseSig = getSignalsByName(trigRun,'Pulse'); Simulink.sdi.addTrigger(pulseSig,'Type','Edge','Level',0.5);
You can verify that the trigger was added and configured correctly by opening the Simulation Data Inspector using
Simulink.sdi.view and clicking the trigger icon next to the
Pulse signal to check the configuration. You can also use the
Simulink.sdi.getTrigger function to check which signal is used to generate trigger events and the trigger configuration.
[sig,trigOpts] = Simulink.sdi.getTrigger; sig.Name
ans = 'Pulse'
trigOpts = struct with fields: Mode: 'Auto' Type: 'Edge' Position: 0.5000 Delay: 0 SourceChannelComplexity: 'Scalar' Polarity: 'Positive' AutoLevel: 1 Level: 0.5000 UpperLevel: 0 LowerLevel: 4.6673e-62 Hysteresis: 0 MinTime: 0 MaxTime: Inf Timeout: 0 Holdoff: 0
When you do not want to use a trigger to control when the Simulation Data Inspector updates the plots with fresh data, you can remove the trigger using the
You can verify that the trigger was removed in the Simulation Data Inspector UI or using the
Simulink.sdi.getTrigger function. The
Simulink.sdi.getTrigger function returns an empty array of
Simulink.sdi.Signal objects when no trigger is configured in the Simulation Data Inspector.
sig = Simulink.sdi.getTrigger; size(sig)
ans = 1×2 0 0
To remove a trigger from a signal using the Simulation Data Inspector UI, click the trigger symbol next to the signal, then click Remove.
Introduced in R2020b