| Instrument Control Toolbox | ![]() |
Return instrument objects from memory to the MATLAB workspace
Syntax
out = instrfind out = instrfind('PropertyName',PropertyValue,...) out = instrfind(S) out = instrfind(obj,'PropertyName',PropertyValue,...)
Arguments
Description
out = instrfind
returns all valid instrument objects as an array to out.
out = instrfind(' returns an array of instrument objects whose property names and property values match those specified.PropertyName',PropertyValue,...)
out = instrfind(S)
returns an array of instrument objects whose property names and property values match those defined in the structure S. The field names of S are the property names, while the field values are the associated property values.
out = instrfind(obj,' restricts the search for matching property name/property value pairs to the instrument objects listed in PropertyName',PropertyValue,...)
obj.
Remarks
You must specify property values using the same format as the get function returns. For example, if get returns the Name property value as MyObject, instrfind 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 string values. For example, instrfind 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 string values.
You can use property name/property value string pairs, structures, and cell array pairs in the same call to instrfind.
Example
Suppose you create the following two GPIB objects.
You can use instrfind to return instrument objects based on property values.
You can also use instrfind to return cleared instrument objects to the MATLAB workspace.
clear g1 g2 newobjs = instrfind Instrument Object Array Index: Type: Status: Name: 1 gpib open GPIB0-1 2 gpib open GPIB0-2
Assign the instrument objects their original names.
Functions
| instrcreate | instrhelp | ![]() |