TriggerConfiguration
Trigger measurements properties for scope
Description
Use the TriggerConfiguration
object to define a trigger event to
identify the simulation time of specified input signal characteristics. You can use trigger
events to stabilize periodic signals such as a sine wave or capture nonperiodic signals such
as a pulse that occurs intermittently.
You can enable the trigger events either from the toolstrip or from the command line. To enable a trigger event from the scope interface, open the Trigger tab and click Enable Trigger in the Controls section.
Creation
Description
trigger = TriggerConfiguration()
creates a trigger configuration
object trigger
.
Properties
All properties are tunable.
For more information on these triggers and the associated parameters, see Source/Type and Levels/Timing Panes.
Mode
— Display update mode
"auto"
(default) | "normal"
| "once"
Display update mode, specified as one of these:
"auto"
–– Display data from the last trigger event. If no event occurs after one time span, display the last available data."normal"
–– Display data from the last trigger event. If no event occurs, the display remains blank."once"
–– Display data from the last trigger event and freeze the display. If no event occurs, the display remains blank. Click the Rearm button () to look for the next trigger event.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Setup section, set Mode to one of the available options.
Data Types: char
| string
Type
— Type of trigger
"edge"
(default) | "pulse-width"
| "transition"
| "runt"
| "window"
| "timeout"
Type of trigger, specified as one of the following:
"edge"
–– Trigger when the signal crosses a threshold."pulse-width"
–– Trigger when the signal crosses a low threshold and a high threshold twice within a specified time."transition"
–– Trigger on the rising or falling edge of a signal that crosses the high and low levels within a specified time range."runt"
–– Trigger when a signal crosses a low threshold or a high threshold twice within a specified time."window"
–– Trigger when a signal stays within or outside a region defined by the high and low thresholds for a specified time."timeout"
–– Trigger when a signal stays above or below a threshold longer than a specified time.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Setup section, set Type to one of the available options.
Data Types: char
| string
Polarity
— Trigger polarity
"rising"
(default) | "falling"
| "either"
| "positive"
| "negative"
| "rise-time"
| "fall-time"
| "inside"
| "outside"
Trigger polarity, specified as one of the following:
"rising"
,"falling"
, or"either"
–– WhenType
is set to"edge"
or"timeout"
."positive"
,"negative"
, or"either"
–– WhenType
is set to"pulse-width"
or"runt"
."rise-time"
,"fall-time"
, or"either"
–– WhenType
is set to"transition"
."inside"
,"outside"
, or"either"
–– WhenType
is set to"window"
.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Setup section, set Polarity to one of the available options.
Data Types: char
| string
AutoLevel
— Automatic thresholding
true
(default) | false
Automatic thresholding of edge-triggered signal, specified as
true
or false
. When you set this property to
false, specify the threshold manually using the Level
property.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, select the Auto Level check box.
Data Types: logical
Position
— Horizontal position of trigger
50
(default) | positive scalar in the range (0 100]
Horizontal position of the trigger on the screen, specified as a positive scalar in the range (0 100].
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, set Position (%) as a positive scalar less than or equal to 100.
Data Types: double
Level
— Threshold of edge-triggered signal
0
(default) | real scalar
Threshold of an edge-triggered signal, specified as a finite real scalar.
Dependency
To enable this property, set AutoLevel
to
false
and Type
to "edge"
or "timeout"
.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, specify the Level as a real scalar.
To enable this property, clear the Auto Level check box and
set Type to Edge
or
Timeout
.
Data Types: double
Hysteresis
— Noise reject value
0
(default) | real scalar
Noise reject value, specified as a finite real scalar. For more information on hysteresis, see Hysteresis of Trigger Signals.
Dependency
To enable this property, set AutoLevel
to
false
and Type
to "edge"
or "timeout"
.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, specify the Hysteresis as a real scalar.
To enable this property, clear the Auto Level check box and
set Type to Edge
or
Timeout
.
Data Types: double
LowLevel
— Lower trigger level of window-triggered signal
0.2
(default) | real scalar
Lower trigger level of window-triggered signal, specified as a finite real scalar.
Dependency
To enable this property, set AutoLevel
to
false
and Type
to
"pulse-width"
, "transition"
,
"runt"
, or "window"
.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, specify the Low as a real scalar.
To enable this property, clear the Auto Level check box and
set Type to Pulse Width
,
Transition
, Runt
, or
Window
.
Data Types: double
HighLevel
— Higher trigger level of window-triggered signal
2.3
(default) | real scalar
Higher trigger level of window-triggered signal, specified as a finite real scalar.
Dependency
To enable this property, set AutoLevel
to
false
and Type
to
"pulse-width"
, "transition"
,
"runt"
, or "window"
.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, specify the High as a real scalar.
To enable this property, clear the Auto Level check box and
set Type to Pulse Width
,
Transition
, Runt
, or
Window
.
Data Types: double
MinPulseWidth
— Minimum pulse width for pulse or runt-triggered signal
0
(default) | nonnegative scalar
Minimum pulse width for a pulse or runt-triggered signal, specified as a nonnegative scalar.
Dependency
To enable this property, set Type
to
"pulse-width"
or "runt"
.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, specify the Min Width (s) as a nonnegative scalar.
To enable this property, set Type to Pulse
Width
or Runt
.
Data Types: double
MaxPulseWidth
— Maximum pulse width for pulse or runt-triggered signal
Inf
(default) | nonnegative scalar
Maximum pulse width for a pulse or runt-triggered signal, specified as a nonnegative scalar.
Dependency
To enable this property, set Type
to
"pulse-width"
or "runt"
.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, specify the Max Width (s) as a nonnegative scalar.
To enable this property, set Type to Pulse
Width
or Runt
.
Data Types: double
MinDuration
— Minimum duration for transition or window-triggered signal
0
(default) | nonnegative scalar
Minimum duration for a transition or window-triggered signal, specified as a nonnegative scalar.
Dependency
To enable this property, set Type
to
"transition"
or "window"
.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, specify the Min Time (s) as a nonnegative scalar.
To enable this property, set Type to
Transition
or Window
.
Data Types: double
MaxDuration
— Maximum duration for transition or window-triggered signal
Inf
(default) | nonnegative scalar
Maximum time duration for a transition or window-triggered signal, specified as a nonnegative scalar.
Dependency
To enable this property, set Type
to
"transition"
or "window"
.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, specify the Max Time (s) as a nonnegative scalar.
To enable this property, set Type to
Transition
or Window
.
Data Types: double
Timeout
— Timeout duration
0
(default) | nonnegative scalar
Timeout duration for a timeout-triggered signal, specified as a nonnegative scalar.
Dependency
To enable this property, set Type
to
"timeout"
.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, specify the Timeout (s) as a nonnegative scalar.
To enable this property, set Type to
Timeout
.
Data Types: double
Delay
— Trigger offset
0
(default) | real scalar
Trigger offset in seconds, specified as a finite real scalar.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, specify the Delay (s) as a real scalar.
Data Types: double
Holdoff
— Minimum time between triggers
0
(default) | nonnegative scalar
Minimum time between trigger events, specified as a finite nonnegative scalar.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. In the Properties section, specify the Holdoff (s) as a nonnegative scalar.
Data Types: double
Channel
— Trigger channel
1
(default) | positive integer
Trigger channel, specified as a positive integer.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip. Select a channel from the Channel drop down.
Data Types: double
Enabled
— Enable trigger
false
(default) | true
Enable trigger, specified as true
or false
.
Set this property to true
to enable trigger.
Scope Window Use
Click the Trigger tab on the Time Scope toolstrip, and the click Enable Trigger in the Controls section.
Data Types: logical
Examples
Enable Trigger Programmatically in Time Scope MATLAB Object
View a sine wave in the Time Scope. This sine wave is streaming
constantly in the display and cannot be captured without stabilization. To stabilize the
sine wave, enable a trigger event programmatically on the scope display using the
Enabled
property of the TriggerConfiguration
object. Alternatively, you can enable the trigger by clicking the Enable
Trigger button on the Trigger tab of the
toolstrip.
Create Sine Wave
Create the input sine wave using the sin
function. Create a
timescope
MATLAB® object to display the signal. Set the TimeSpan
property
to 1 second.
f = 100; fs = 1000; swv = sin(2.*pi.*f.*(0:1/fs:1-1/fs)).'; scopeNoTrigger = timescope(SampleRate=fs,... TimeSpanSource="property", ... TimeSpan=1);
Display the sine wave in the scope. You can see that the signal in the scope is constantly moving.
while(1) scopeNoTrigger(swv) end release(scopeNoTrigger)
Enable Trigger
Now enable a trigger event to stabilize the signal.
You can either enable the trigger event in the scope during simulation or enable the trigger event programmatically when creating the object.
To use the programmatic approach, create another timescope
object
and enable the trigger event programmatically while creating the object.
scope = timescope(SampleRate=fs,... TimeSpanSource="property",... TimeSpan=1); scope.Trigger.Enabled = true; scope.Trigger.Type = "transition"; scope.Trigger
TriggerConfiguration with properties: Mode: 'auto' Type: 'transition' Polarity: 'rise-time' AutoLevel: 1 Position: 50 LowLevel: 0.2000 HighLevel: 2.3000 MinDuration: 0 MaxDuration: Inf Delay: 0 Holdoff: 0 Channel: 1 Enabled: 1
Stream in the sine wave signal again.
while(1) scope(swv) end release(scope)
The display freezes as you have enabled the trigger.
The triangle markers show the trigger positions and levels. For more information on the trigger, hover over the triangle.
Version History
Introduced in R2022a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)