trigger (hostScope)

Software-trigger start of data acquisition for host scope

Description

example

scope_object_vector = trigger(scope_object_vector) triggers the scope represented by the scope object to acquire the number of data points in the scope object property NumSamples.

If the scope object property TriggerMode has the value software as a character vector or string scalar, this function is the only way to trigger the scope. You can use this function on any scope, regardless of trigger mode setting. For example, if a scope did not trigger because the triggering criteria were not met, you can use this function to force the scope to trigger.

Examples

collapse all

Set a scope to software trigger mode and then force it to trigger. The model is xpcosc.

Set the stop time to infinity.

tg = slrt;
tg.StopTime = Inf;

Configure a scope to capture 'Integrator1' on a software trigger.

sc1 = addscope(tg,'host',1);
s1 = getsignalid(tg,'Integrator1');
addsignal(sc1, s1);
sc1.TriggerMode = 'software'
sc1 = 

   Application          = xpcosc
   ScopeId              = 1
   Status               = Interrupted
   Type                 = Host
   NumSamples           = 250
   NumPrePostSamples    = 0
   Decimation           = 1
   TriggerMode          = Software
   TriggerSignal        = 4  : Integrator1
   TriggerLevel         = 0.000000
   TriggerSlope         = Either
   TriggerScope         = 1
   TriggerSample        = 0
   StartTime            = -1.000000
   Data                 = Matrix (250 x 1)
   Time                 = Matrix (250 x 1)
   Signals              = 4  : Integrator1

Start the scope.

start(sc1)
ans =
 
Simulink Real-Time Scope
   Application          = xpcosc
   ScopeId              = 1
   Status               = Pre-Acquiring
   Type                 = Host
   NumSamples           = 250
   NumPrePostSamples    = 0
   Decimation           = 1
   TriggerMode          = Software
   TriggerSignal        = 4  : Integrator1
   TriggerLevel         = 0.000000
   TriggerSlope         = Either
   TriggerScope         = 1
   TriggerSample        = 0
   Signals              = 4  : Integrator1

Start the real-time application and trigger the scope.

start(tg);
pause(0.5);
trigger(sc1)
ans = 

Simulink Real-Time Scope
   Application          = xpcosc
   ScopeId              = 1
   Status               = Acquiring
   Type                 = Host
   NumSamples           = 250
   NumPrePostSamples    = 0
   Decimation           = 1
   TriggerMode          = Software
   TriggerSignal        = 4  : Integrator1
   TriggerLevel         = 0.000000
   TriggerSlope         = Either
   TriggerScope         = 1
   TriggerSample        = 0
   Signals              = 4  : Integrator1

Stop the real-time application and the scope.

stop(tg);
stop(sc1);

Input Arguments

collapse all

Get a scope object by calling the target object methods SimulinkRealTime.target.addscope or SimulinkRealTime.target.getscope.

Output Arguments

collapse all

This vector is the same as scope_object_vector, but with the changes that were made by the function call.

Introduced in R2014a