Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

instrfindall

Find visible and hidden instrument objects

Syntax

out = instrfindall
out = instrfindall('P1',V1,...)
out = instrfindall(s)
out = instrfindall(objs,'P1',V1,...)

Arguments

'P1'

Name of an instrument object property or device group object property

V1

Value allowed for corresponding P1.

s

A structure of property names and property values.

objs

An array of instrument objects or device group objects.

out

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('P1',V1,...) returns an array, 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,'P1',V1,...) restricts the search for objects with matching property name/value pairs to the instrument objects and device group objects listed in 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.

Introduced before R2006a

Was this topic helpful?