Main Content

aardvarkfind

Find Total Phase Aardvark controllers

Since R2024a

Description

A = aardvarkfind finds existing persistent connections to Total Phase® Aardvark I2C/SPI™ controllers and returns an array of aardvark objects corresponding to each connection.

example

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

example

Examples

collapse all

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

A = aardvarkfind
A = 

  Aardvark with properties:

                   Model: "Total Phase Aardvark"
            SerialNumber: "2239143731"
                     Tag: ""
    AvailableDigitalPins: ["Pin1"    "Pin3"    "Pin5"    "Pin7"    "Pin8"    "Pin9"]

To close this connection, delete A.

delete(A)

This command deletes the aardvark object and disconnects the device. If you want to reconnect to the device, you must create a new connection with aardvark.

After the deletion, calling aardvarkfind confirms that there are no existing connections.

aardvarkfind
ans =

     []

Note that the variable A is still present in the workspace, but it is now an invalid handle.

A
A = 

  handle to deleted Aardvark

The variable persists after deletion of the interface because aardvark 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 A

You can assign a tag to a connection and use that tag with aardvarkfind to access the connection later. Such tags are useful when you have multiple interfaces 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 aardvark.

Create two Aardvark controller connections, assigning values to the Tag property.

a1 = aardvark("2239143731",Tag="Accel");
a2 = aardvark("2239277489",Tag="Temp");

Find the connection that has the tag "Accel".

A = aardvarkfind(Tag="Accel")
A = 

  Aardvark with properties:

                   Model: "Total Phase Aardvark"
            SerialNumber: "2239143731"
                     Tag: "Accel"
    AvailableDigitalPins: ["Pin1"    "Pin3"    "Pin5"    "Pin7"    "Pin8"    "Pin9"]

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: aardvarkfind(Tag="Accel",Model="Total Phase Aardvark") returns existing connections to Total Phase Aardvark controllers whose Tag property is set to "Accel".

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

Output Arguments

collapse all

Total Phase Aardvark I2C/SPI controller connections, returned as an aardvark object or an array of aardvark objects. If you call aardvarkfind with no name-value arguments, A contains all existing connections. Otherwise, A contains all connections whose properties match the values you specify with name-value arguments.

A is empty if:

  • There are no existing Aardvark I2C/SPI controller 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", then A is empty.

  • You try to match a property the aardvark object does not have. For instance, aardvarkfind(Address="198.51.100.255") returns an empty array because aardvark does not have an Address property.

Tips

  • aardvarkfind finds existing aardvark connections. To get a list of all Aardvark I2C/SPI controller boards in the system whether or not connections exist, use aardvarklist.

Version History

Introduced in R2024a