addsignal (hostScope,signal)

Add signals to host scope represented by scope object

Description

example

scope_object_vector = addsignal(scope_object_vector, signal_index_vector) adds one or more signals to one or more scope objects. Specify the signals by their indices, which you can retrieve by using the target object method SimulinkRealTime.target.getsignalid. If scope_object_vector contains two or more scope objects, the same signals are assigned to each scope. Before you can add a signal to a scope, you must stop the scope.

At the target computer command line, you can add one or more signals to the scope:

addsignal scope_index = signal_index1, signal_index2, . . .

Examples

collapse all

Add one signal to a host scope. The model is xpcosc.

Create host scope.

tg = slrt;
sc1 = addscope(tg, 'host', 1);

Get index of signal Integrator.

s1 = getsignalid(tg,'Integrator');

Add the signal to the scope.

scope_object_vector = addsignal(sc1, s1)
scope_object_vector = 

Simulink Real-Time Scope
   Application          = xpcosc
   ScopeId              = 1
   Status               = Interrupted
   Type                 = Host
   NumSamples           = 250
   NumPrePostSamples    = 0
   Decimation           = 1
   TriggerMode          = FreeRun
   TriggerSignal        = 3  : Integrator
   TriggerLevel         = 0.000000
   TriggerSlope         = Either
   TriggerScope         = 1
   TriggerSample        = 0
   StartTime            = -1.000000
   Data                 = Matrix (250 x 1)
   Time                 = Matrix (250 x 1)
   Signals              = 3  : Integrator

Add a vector of signals to a vector of host scopes. The model is xpcosc.

Create host scopes.

tg = slrt;
sc2 = addscope(tg, 'host', 2);
sc3 = addscope(tg, 'host', 3);

Get indices of signals Integrator1 and Signal Generator.

s1 = getsignalid(tg,'Integrator');
s2 = getsignalid(tg,'Signal Generator');
s3 = getsignalid(tg,'Integrator1');

Add the signals to the scopes.

scope_object_vector = addsignal([sc2 sc3], [s1, s2, s3])
scope_object_vector = 

Simulink Real-Time Scope
   Application          = xpcosc
   ScopeId              = 2
   Status               = Interrupted
   Type                 = Host
   NumSamples           = 250
   NumPrePostSamples    = 0
   Decimation           = 1
   TriggerMode          = FreeRun
   TriggerSignal        = 3  : Integrator
   TriggerLevel         = 0.000000
   TriggerSlope         = Either
   TriggerScope         = 2
   TriggerSample        = 0
   StartTime            = -1.000000
   Data                 = Matrix (250 x 3)
   Time                 = Matrix (250 x 1)
   Signals              = 3  : Integrator
                          5  : Signal Generator
                          4  : Integrator1

Simulink Real-Time Scope
   Application          = xpcosc
   ScopeId              = 3
   Status               = Interrupted
   Type                 = Host
   NumSamples           = 250
   NumPrePostSamples    = 0
   Decimation           = 1
   TriggerMode          = FreeRun
   TriggerSignal        = 3  : Integrator
   TriggerLevel         = 0.000000
   TriggerSlope         = Either
   TriggerScope         = 3
   TriggerSample        = 0
   StartTime            = -1.000000
   Data                 = Matrix (250 x 3)
   Time                 = Matrix (250 x 1)
   Signals              = 3  : Integrator
                          5  : Signal Generator
                          4  : Integrator1

Input Arguments

collapse all

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

Get a signal index by calling the target object method SimulinkRealTime.target.getsignalid.

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