Documentation

SimulinkRealTime.target.addscope

Create a scope of specified type

Syntax

scope_object = addscope(target_object)
scope_object = addscope(target_object, scope_type, scope_number)
scope_object_vector = addscope(target_object, scope_type, scope_number_vector)

Description

example

scope_object = addscope(target_object) creates on the target computer a host scope and assigns as its scope number the next available integer in the target object property Scopes. It returns the object representing this scope.

example

scope_object = addscope(target_object, scope_type, scope_number) creates on the target computer a scope of the given type with the given scope number. It returns the object representing this scope.

example

scope_object_vector = addscope(target_object, scope_type, scope_number_vector) creates on the target computer a set of scopes of the given type with the given scope numbers. It returns a vector of objects representing these scopes.

addscope updates the target object property Scopes. If the result is not assigned to a MATLAB® variable, the scope object properties are listed in the Command Window.

The Simulink® Real-Time™ product supports nine target scopes, eight file scopes, and as many host scopes as the target computer resources can support. If you try to add a scope with the same index as an existing scope, the result is an error.

At the target computer command line, you can add a single target scope:

addscope
addscope scope_number

Examples

collapse all

Create a default (host) scope with the default (next available) number and assign it to sc1

tg = slrt;
sc1 = addscope(tg)
sc1 = 

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

Create a file scope with number 2 and assign it to sc2.

tg = slrt;
sc2 = addscope(tg,'file',2)
sc2 = 

Simulink Real-Time Scope
   Application          = xpcosc
   ScopeId              = 2
   Status               = Interrupted
   Type                 = File
   NumSamples           = 250
   NumPrePostSamples    = 0
   Decimation           = 1
   TriggerMode          = FreeRun
   TriggerSignal        = -1 
   TriggerLevel         = 0.000000
   TriggerSlope         = Either
   TriggerScope         = 2
   TriggerSample        = 0
   FileName             = unset
   WriteMode            = Lazy
   WriteSize            = 512
   AutoRestart          = off
   DynamicFileName      = off
   MaxWriteFileSize     = 536870912
   Signals              = no Signals defined

Create two target scopes 3 and 4 using a vector of scope numbers and assign the scope objects to variable scope_object_vector.

tg = slrt;
scope_object_vector = addscope(tg, 'target', [3, 4])
scope_object_vector = 

Simulink Real-Time Scope
   Application          = xpco   ScopeId              = 3
   Status               = Interrupted
   Type                 = Target
   NumSamples           = 250
   NumPrePostSamples    = 0
   Decimation           = 1
   TriggerMode          = FreeRun
   TriggerSignal        = -1 
   TriggerLevel         = 0.000000
   TriggerSlope         = Either
   TriggerScope         = 3
   TriggerSample        = 0
   DisplayMode          = Redraw (Graphical)
   YLimit               = Auto
   Grid                 = on
   Signals              = no Signals defined

Simulink Real-Time Scope
   Application          = xpcosc
   ScopeId              = 4
   Status               = Interrupted
   Type                 = Target
   NumSamples           = 250
   NumPrePostSamples    = 0
   Decimation           = 1
   TriggerMode          = FreeRun
   TriggerSignal        = -1 
   TriggerLevel         = 0.000000
   TriggerSlope         = Either
   TriggerScope         = 4
   TriggerSample        = 0
   DisplayMode          = Redraw (Graphical)
   YLimit               = Auto
   Grid                 = on
   Signals              = no Signals defined

Input Arguments

collapse all

Object that represents the target computer. Before calling this function, make sure that you start the target computer with the Simulink Real-Time kernel and apply the required Ethernet link settings.

Example: tg

Type of scope to create, as a character vector. This argument is optional. The default value is 'host'.

New scope number. This argument is optional. The default value is the next available integer in the target object property Scopes.

If you enter the scope number for an existing scope object, the result is an error.

Example: 1

Vector of new scope numbers. If you enter the scope number for an existing scope object, the result is an error.

Example: [2, 3]

Output Arguments

collapse all

Object representing the newly created scope

Vector containing objects representing the newly created scope

Introduced in R2014a

Was this topic helpful?