xPC Target | ![]() ![]() |
Signal Tracing with MATLAB Commands
Creating a target scope object allows you to select and view signals using the xPC Target functions. This section describes how to signal trace using xPC Target functions instead of using the xPC Target graphical interface.
After you create and download, the target application, you can view output signals. This procedure uses the Simulink model xpcosc.mdl
as an example, and assumes you have build the target application for that model.
The MATLAB window displays a list of the target objects properties for the
available signals. For example, the signals for the model xpcosc.mdl
are
shown below.
ShowSignals = On Signals = PROP. VALUE BLOCK NAME S0 0.000000 Integrator1 S1 0.000000 Signal Generator S2 0.000000 Gain S3 0.000000 Integrator S4 0.000000 Gain1 S5 0.000000 Gain2 S6 0.000000 Sum
The signal names (S0, S1 . . .S6) are properties of the target object. And the Parameter identifiers (P0, P1, . . .P6) are properties of the target object.
1
and an scope object name of sc1
, typesc1=tg.addscope('target', 1) or sc1=addscope(tg, 'target', 1)
sc1
, typesc1
The MATLAB window displays a list of the scope object properties. Notice the scope properties StartTime, Time, and Data are not accessible with a scope of type target.
xPC Scope Object Application = xpcosc ScopeId = 1 Status = Interrupted Type = Target NumSamples = 250 Decimation = 1 TriggerMode = FreeRun TriggerSignal = -1 TriggerLevel = 0 TriggerSlope = Either TriggerScope = 1 Mode = Redraw (Graphical) YLimit = Auto Grid = On StartTime = Not accessible Data = Not accessible Time = Not accessible Signals = no Signals defined
Integrator1
and Signal Generator
, typetg.addsignal (sc1,[0,1]) or addsignal(sc1,[0,1])
The target PC displays the following messages.
Scope: 1, signal 0 added Scope: 1, signal 1 added
After you add signals to a scope object, the signals are not shown on the target screen until you start the scope.
+sc1 or sc.start or start(sc1)
The target screen plots the signals after collecting each data package. During this time you can observe the behavior of the signals while the scope is running.
The signals shown on the target PC stop updating while the target application continues running, and the target PC displays the following message.
Scope: 1, set to state 'interrupted'
![]() | Signal Tracing with xPC Target GUI (Target Manager) | Parameter Tuning | ![]() |