List of serial ports connected to your system
returns a list of all serial ports on a system. The list includes virtual serial ports
provided by USB-to-serial devices and Bluetooth® Serial Port Profile devices. The list shows all the serial ports you can
access on your computer and can use for serial port communication.
serialportlist("available") returns a list of only those serial
ports on your system that are available at this time.
Identify serial ports on your system.
ports = serialportlist
ports = 1×4 string array "COM1" "COM3" "COM11" "COM12"
List only those ports that are available.
freeports = serialportlist("available")
freeports = 1×2 string array "COM1" "COM12"