Main Content

icdevicefind

Find device connections

Since R2024b

Description

d = icdevicefind finds existing persistent device connections and returns an array of icdevice objects corresponding to each connection.

example

d = icdevicefind(Name=Value) finds connections with property values matching those specified by one or more name-value arguments. For instance, d = icdevicefind(Tag="Scope") returns existing device connections whose Tag property is set to "Scope".

example

Examples

collapse all

When you have an icdevice connection that exists in the MATLAB® workspace or is saved as a class property or app property, the icdevice object might not be accessible in a different function or app callback. In this case, you can use icdevicefind to find and delete all these connections.

delete(icdevicefind)

You can assign a tag to a connection and use that tag with icdevicefind to access the connection later. Such tags are useful when you have multiple device connections to keep track of across several functions. Tags are also useful for locating and accessing connections in app callbacks. To set the tag value, use the Tag property of icdevice.

Create two device connections, assigning values to the Tag property.

instr1 = icdevice('AgInfiniiVision','GPIB0::01::INSTR',Tag="Scope1",LegacyMode=false);
instr2 = icdevice('AgInfiniium','GPIB0::02::INSTR',LegacyMode=false);

Find the device connection with the tag "Scope1".

d1 = icdevicefind(Tag="Scope1")

Find the device using the AgInfiniium.mdd driver.

d2 = icdevicefind(DriverName="AgInfiniium")

Input Arguments

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: icdevicefind(Tag="Scope")

For icdevicefind, you can use one or more properties of the icdevice object as name-value arguments to specify characteristics of the connections you want to find.

Output Arguments

collapse all

Device connections, returned as a icdevice object or an array of icdevice objects. If you call icdevicefind with no Name=Value pairs, d contains all existing device connections. Otherwise, d contains all connections whose properties match the values you specify with Name=Value pairs.

d is empty if:

  • There are no existing device connections.

  • No existing connections match the specified property values. For instance, if you specify Tag="Scope", and there is no existing connection whose Tag property is "Scope".

  • You try to match a nonexistent icdevice property.

Tips

  • The icdevicefind function finds only those device connections created with LegacyMode=false.

Version History

Introduced in R2024b

See Also

Functions