Scan nearby Bluetooth Classic devices
Scan nearby Bluetooth Classic devices and check their connection status.
bluetoothlist to list all nearby devices. If your device is
already connected to another device or application, it might not appear in this list.
Disconnect your device from any other devices or applications first for MATLAB® to
devlist = bluetoothlist
devlist=5×4 table Name Address Channel Status _____________ ______________ _______ __________________ "Pixel 3" "3C286DD533CA" 8 "Ready to connect" "HC-06" "98D331FB3B77" 1 "Requires pairing" "mjin-maci" "A886DDA44062" 3 "Requires pairing" "DMTDevice" "B0B448F47A4C" Unknown "Unknown"
Address columns identify the
Channel column indicates the device SPP channel. The
Status column describes the current device connection
You can also specify a timeout value less than the default 35 seconds on Windows and 20 seconds on macOS.
devlist = bluetoothlist("Timeout",10)
devlist=3×4 table Name Address Channel Status _____________ ______________ _______ __________________ "Pixel 3" "3C286DD533CA" 8 "Ready to connect" "mjin-maci" "A886DDA44062" 3 "Requires pairing"
devlist— List of nearby Bluetooth devices
List of nearby Bluetooth devices, returned as a table. The table has the following columns.
Name— Device name
Device name, returned as a string scalar. Multiple devices can share the same name.
Address— Device identifier
Device identifier, returned as a string scalar.
Channel— Device channel
Device SPP channel, returned as a categorical scalar. If the channel is
unknown, the value in this column is
Status— Device connection status
"Ready to connect"|
Device connection status, returned as a string. You can connect to a
Bluetooth device using
bluetooth only if
its status is
"Ready to connect". Possible values
|Device supports SPP, is paired, and not connected anywhere.|
|Device supports SPP and is not paired.|
|Device supports SPP and is connected.|
|Device does not support SPP.|
|Unknown if device supports SPP. Device is turned off or fails to respond to scanning request.|