visadevfind
Description
finds existing VISA device
connections and returns an array of objects corresponding to each connection. V
= visadevfind
finds VISA device connections with property values matching those specified by one or more
name-value arguments. For instance, V
= visadevfind(Name=Value
)V = visadevfind(Tag="Scope")
returns
existing connections whose Tag
property is set to
"Scope"
.
Examples
When you have a visadev
connection that exists in the MATLAB® workspace or is saved as a class property or app property, the visadev
object might not be accessible in a different function or app callback. In this case, you can use visadevfind
to find and delete the connection.
V = visadevfind
V = TCPIP with properties: ResourceName: "TCPIP0::K-N9040B-91124.dhcp.mathworks.com::inst0::INSTR" Alias: "" Vendor: "Keysight Technologies" Model: "N9040B" LANName: "inst0" InstrumentAddress: "172.31.173.155" Tag: "Analyzer"
To close this connection, delete V
.
delete(V)
This command deletes the visadev
object and disconnects the device. If you
want to reconnect to the device, you must create a new connection with
visadev
.
After the deletion, calling visadevfind
confirms that there are no existing connections.
visadevfind
ans = []
Note that the variable V
is still present in the workspace, but it is now an invalid handle.
V
V = handle to deleted TCPIP
The variable persists after deletion of the interface because visadev
is a handle object. (For more information about this type of object, see Handle Object Behavior.) You can use clear
to remove the invalid handle from the workspace.
clear V
You can assign a tag to a connection and use that tag with
visadevfind
to access the connection later. Such tags are useful when
you open a connection in one function and use a different function to perform operations
on the connection. Tags are also useful for locating and accessing connections in app
callbacks. To set the tag value, use the Tag
property of the VISA
interface object.
Create two VISA device connections, assigning values to the Tag
property.
scopeResource = "USB0::0x2A8D::0x0386::CN59206154::0::INSTR"; v1 = visadev(scopeResource,Tag="Scope"); analyzerResource = "TCPIP0::K-N9040B-91124.dhcp.mathworks.com::inst0::INSTR"; v2 = visadev(analyzerResource,Tag="Analyzer");
Find the connection with the tag "Analyzer"
.
V = visadevfind(Tag="Analyzer")
V = TCPIP with properties: ResourceName: "TCPIP0::K-N9040B-91124.dhcp.mathworks.com::inst0::INSTR" Alias: "" Vendor: "Keysight Technologies" Model: "N9040B" LANName: "inst0" InstrumentAddress: "172.31.173.155" Tag: "Analyzer"
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: visadevfind(Type="gpib",Tag="Scope")
returns existing
VISA-GPIB device connections whose Tag
property is set to
"Scope"
.
For visadev
, you can use one or more of the interface properties
listed on visadev Properties as name-value arguments to specify characteristics of the
connections you want to find.
Output Arguments
VISA device connections, returned as a VISA interface object (see visadev
)
or an array of such objects. If you call visadevfind
with no
name-value arguments, V
contains all existing connections.
Otherwise, V
contains all connections whose properties match the
values you specify with name-value arguments.
V
is empty if:
There are no existing VISA device connections.
No existing connections match the specified property values. For instance, if you specify
Tag="Scope"
and there is no existing connection whoseTag
property is"Scope"
, thenV
is empty.You try to match a property that does not exist in visadev Properties. For instance,
visadevfind(Speed=14400)
returns an empty array because the VISA interface does not have aSpeed
property.
visadevfind
finds existing VISA device interfaces. To get a list of all available devices whether or not connections to them exist, usevisadevlist
.
Version History
Introduced in R2024a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)