addscope - Create scopes

Syntax

MATLAB® command line

Create a scope and scope object without assigning to a MATLAB variable.

addscope(target_object, scope_type, scope_number)
target_object.addscope(scope_type, scope_number)

Create a scope, scope object, and assign to a MATLAB variable

scope_object = addscope(target_object, scope_type, scope_number)
scope_object = target_object.addscope(scope_type, scope_number)

Target PC command line — When you are using this command on the target PC, you can only add a scope of type target.

addscope
addscope scope_number

Arguments

target_object

Name of a target object. The default target name is tg.

scope_type

Values are 'host', 'target', or 'file'. This argument is optional with host as the default value.

scope_number

Vector of new scope indices. This argument is optional. The next available integer in the target object property Scopes as the default value.

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

Description

addscope creates a scope of the specified type and updates the target object property Scopes. This method returns a scope object vector. If the result is not assigned to a variable, the scope object properties are listed in the MATLAB window. The xPC Target™ product supports 10 scopes of scopes of type target and host, and eight scopes of type file, for a maximum of 28 scopes. If you try to add a scope with the same index as an existing scope, the result is an error.

A scope acquires data from the target application and displays that data on the target PC, uploads the data to the host PC, or stores that data in a file in the target PC file system.

All scopes of type target, host, or file run on the target PC.

Scope of type target — Data collected is displayed on the target screen and acquisition of the next data package is initiated by the kernel.

Scope of type host — Collects data and waits for a command from the host PC for uploading the data. The data is then displayed using a scope viewer on the host or other MATLAB functions.

Scope of type file — Data collected is stored in a file in the target PC file system. You can then transfer the data to another PC for examination or plotting.

Examples

Create a scope and scope object sc1 using the method addscope. A target scope is created on the target PC with an index of 1, and a scope object is created on the host PC, assigned to the variable sc1. The target object property Scopes is changed from No scopes defined to 1.

sc1 = addscope(tg,'target',1) 

or

sc1 = tg.addscope('target',1)

Create a scope with the method addscope and then create a scope object, corresponding to this scope, using the method getscope. A target scope is created on the target PC with an index of 1, and a scope object is created on the host PC, but it is not assigned to a variable. The target object property Scopes is changed from No scopes defined to 1.

addscope(tg,'target',1) or tg.addscope('target',1)
sc1 = getscope(tg,1) or sc1 = tg.getscope(1)

Create two scopes using a vector of scope objects scvector. Two target scopes are created on the target PC with scope indices of 1 and 2, and two scope objects are created on the host PC that represent the scopes on the target PC. The target object property Scopes is changed from No scopes defined to 1,2.

scvector = addscope(tg, 'target', [1, 2])

Create a scope and scope object sc4 of type file using the method addscope. A file scope is created on the target PC with an index of 4. A scope object is created on the host PC and is assigned to the variable sc4. The target object property Scopes is changed from No scopes defined to 4.

sc4 = addscope(tg,'file',4) or sc4 = tg.addscope('file',4)

See Also

xPC Target target object methods remscope and getscope.

xPC Target M-file demo scripts listed in xPC Target™ Demos.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS