Skip to Main Content Skip to Search
Product Documentation

Tag - Specify label to associate with instrument object

Description

You configure Tag to be a string value that uniquely identifies an instrument object.

Tag is particularly useful when constructing programs that would otherwise need to define the instrument object as a global variable, or pass the object as an argument between callback routines.

You can return the instrument object with the instrfind function by specifying the Tag property value.

Characteristics

Usage

Any instrument object

Read only

Never

Data type

String

Values

The default value is an empty string.

Examples

Suppose you create a serial port object on a Windows machine associated with the serial port COM1.

s = serial('COM1');
fopen(s);

You can assign s a unique label using Tag.

set(s,'Tag','MySerialObj')

You can access s in the MATLAB workspace or in a file using the instrfind function and the Tag property value.

s1 = instrfind('Tag','MySerialObj');

See Also

Functions

instrfind

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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