instrfindall
(To be removed) Find visible and hidden instrument objects
This function that uses serial, Bluetooth,
tcpip, udp, visa,
gpib, or i2c will be removed in a future release.
Use serialport, bluetooth,
tcpclient,
tcpserver,
udpport,
visadev,
aardvark/device, or
ni845x/device
instead. For more information on updating your code, see Version History.
Syntax
out = instrfindall
out = instrfindall('P1',V1,...)
out = instrfindall(s)
out = instrfindall(objs,'P1',V1,...)
Arguments
| Name of an instrument object property or device group object property |
| Value allowed for corresponding
|
| A structure of property names and property values. |
| An array of instrument objects or device group objects. |
| An array of returned instrument objects or device group objects. |
Description
out = instrfindall finds all instrument
objects and device group objects, regardless of the value of the objects'
ObjectVisibility property. The object or objects are returned
to out.
out = instrfindall('
returns an array, P1',V1,...)out, of instrument objects and device group
objects whose property names and corresponding property values match those specified
as arguments.
out = instrfindall(s) returns an array,
out, of instrument objects whose property names and
corresponding property values match those specified in the structure
s, where the field names correspond to property names and the
field values correspond to the current value of the respective property.
out = instrfindall(objs,'
restricts the search for objects with matching property name/value pairs to the
instrument objects and device group objects listed in
P1',V1,...)objs.
Note that you can use character vector property name/property value pairs,
structures, and cell array property name/property value pairs in the same call to
instrfindall.
Examples
Suppose you create the following instrument objects on a Windows® machine.
s1 = serial('COM1');
s2 = serial('COM2');
g1 = gpib('mcc',0,2);
g1.ObjectVisibility = 'off'Because object g1 has its ObjectVisibility
set to off, it is not visible to commands like instrfind:
instrfind Instrument Object Array Index: Type: Status: Name: 1 serial closed Serial-COM1 2 serial closed Serial-COM2
However, instrfindall finds all objects regardless of the
value of ObjectVisibility:
instrfindall Instrument Object Array Index: Type: Status: Name: 1 serial closed Serial-COM1 2 serial closed Serial-COM2 3 gpib closed GPIB0-2
The following statements use instrfindall to return objects
with specific property settings, which are passed as cell arrays:
props = {'PrimaryAddress','SecondaryAddress};
vals = {2,0};
obj = instrfindall(props,vals);You can use instrfindall as an argument when you want to
apply the command to all objects, visible and invisible. For example, the following
statement makes all objects visible:
set(instrfindall,'ObjectVisibility','on')
Tips
instrfindall differs from instrfind in
that it finds objects whose ObjectVisibility property is set to
off.
Property values are case sensitive. You must specify property values using the
same format as that the property requires. For example, if Name
property value is specified as MyObject,
instrfindall will not find an object with a
Name property value of myobject.
However, this is not the case for properties that have a finite set of character
vector values.
For example, instrfindall will find an object with a
Parity property value of Even or
even. You can use the propinfo function to determine
if a property has a finite set of character vector values.
Note
To get a list of options you can use on a function, press the Tab key after entering a function on the MATLAB® command line. The list expands, and you can scroll to choose a property or value. For information about using this advanced tab completion feature, see Using Tab Completion for Functions.