Main Content

serialportlist

List of serial ports connected to your system

Description

serialportlist or serialportlist("all") 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.

example

Examples

collapse all

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"

Tips

  • serialportlist returns all serial ports on the system, whether connections exist or not. To get a list of existing serialport connections, use serialportfind instead.

Version History

Introduced in R2019b

See Also

Functions