visadevfind
Description
V = visadevfind
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 whose- Tagproperty is- "Scope", then- Vis 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 a- Speedproperty.
- visadevfindfinds existing VISA device interfaces. To get a list of all available devices whether or not connections to them exist, use- visadevlist.
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)