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 VYou 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 whoseTagproperty is"Scope", thenVis 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 aSpeedproperty.
visadevfindfinds 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.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)