Find visible and hidden serial port objects
out = instrfindall
out = instrfindall('P1
',V1,...)
out = instrfindall(s)
out = instrfindall(objs,'P1
',V1,...)
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
.
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')