Display time-domain data on target computer
Controls and accesses properties of target scopes.
The kernel acquires a data package and the scope displays the data on the target computer. Depending on the setting of
DisplayMode, the data is displayed
numerically or graphically by a redrawing or rolling display.
Sliding display will be removed in a future release. It behaves like rolling display.
The following lexical rules exist:
Function names are case sensitive. Type the entire name.
Property names are not case sensitive. You do not need to type the entire name, as long as the characters that you type are unique for the property.
You can invoke some of the scope object properties and functions from the target computer command line when you have loaded the real-time application.
Use scope object properties to select signals that you want to acquire, set triggering modes, and access signal information from the real-time application.
To get the value of a readable scope object property from a scope object:
scope_object = getscope(target_object, scope_number); value = scope_object.scope_object_property
To get the
Decimation of scope
scope_object = getscope(tg, 3); value = scope_object.Decimation
To set the value of a writable scope property from a scope object:
scope_object = getscope(target_object, scope_number); scope_object.scope_object_property = new_value
To set the
Decimation of scope
scope_object = getscope(tg, 3); scope_object.Decimation = 10
Not all properties are
user-writable. For example, after you create the scope, property
DisplayMode— How target scope displays signals
Indicates how a target scope displays the signals:
'redraw' — The scope plots signal values when
the scope has acquired
'numerical' — The scope displays signal values
'rolling' — The scope plots signal values at
every sample time.
'sliding' will be removed in a future release. It
behaves like value
Grid— Displays a grid on target screen
'on', displays a grid on the target screen.
YLimit— Range of y-axis values
'auto'(default) | numeric
Minimum and maximum y-axis limits. If
'auto', the scope calculates
the y-axis limits from the range of data values it is
YLimit— Y-axis minimum and maximum limits for scope
'Auto'| vector | character vector | string scalar
Select the y-axis minimum and maximum limits for scope as
or with a vector containing the minimum and maximum values (for example,
|Add signals to target scope represented by scope object|
|Remove signals from target scope represented by scope object|
|Start execution of target scope on target computer|
|Stop execution of target scope on target computer|
|Software-trigger start of data acquisition for target scope|
Build and download
xpcosc and execute the
real-time application with a target scope.
Open, build, and download the real-time application.
ex_model = 'xpcosc'; open_system(ex_model); rtwbuild(ex_model); tg = slrt('TargetPC1'); load(tg,ex_model); tg
Target: TargetPC1 Connected = Yes Application = xpcosc Mode = Real-Time Single-Tasking Status = stopped CPUOverload = none ExecTime = 0.0000 SessionTime = 9544.6543 StopTime = 0.200000 SampleTime = 0.000250 AvgTET = NaN MinTET = Inf MaxTET = 0.000000 ViewMode = 0 TimeLog = Vector(0) StateLog = Matrix (0 x 2) OutputLog = Matrix (0 x 2) TETLog = Vector(0) MaxLogSamples = 16666 NumLogWraps = 0 LogMode = Normal ProfilerStatus = Ready Scopes = No Scopes defined NumSignals = 7 ShowSignals = off NumParameters = 7 ShowParameters = off
Add and configure target scope
sc1 = addscope(tg, 'target', 1); addsignal(sc1, 4); addsignal(sc1, 5)
ans = Simulink Real-Time Scope Application = xpcosc ScopeId = 1 Status = Interrupted Type = Target NumSamples = 250 NumPrePostSamples = 0 Decimation = 1 TriggerMode = FreeRun TriggerSignal = 4 : Integrator1 TriggerLevel = 0.000000 TriggerSlope = Either TriggerScope = 1 TriggerSample = 0 DisplayMode = Redraw (Graphical) YLimit = Auto Grid = on Signals = 4 : Integrator1 5 : Signal Generator
Run the real-time application for 10 seconds.
tg.StopTime = 10; start(sc1); start(tg); pause(10); stop(tg); stop(sc1);
View the target screen on the development computer.
Unload the real-time application.
Target: TargetPC1 Connected = Yes Application = loader