instrfindall
(To be removed) Find visible and hidden serial port objects
This serial object function will be removed in a future release. Use
serialport
object functions 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,...)
Description
out = instrfindall finds all serial port
objects, regardless of the value of the object’s ObjectVisibility
property. The object or objects are returned to out.
out = instrfindall('
returns an array, P1',V1,...)out, of serial port objects whose property names
and corresponding property values match those specified as arguments.
out = instrfindall(s) returns an array,
out, of serial port 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 serial
port objects listed in P1',V1,...)objs.
Note that you can use string 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 serial port objects on a Windows® platform:
s1 = serial('COM1'); s2 = serial('COM2'); set(s2,'ObjectVisibility','off')
Because object s2 has its ObjectVisibility set
to 'off', it is not visible to commands like
instrfind:
instrfind
Serial Port Object : Serial-COM1
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
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 returned by the get function. For example, if
get returns the Name property value 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 string values.
For example, instrfindall will find an object with a
Parity property value of 'Even' or
'even'.