Get Port List

版本 1.3.0.0 (2.8 KB) 作者: M. A. Hopcroft
Returns a list of serial port names suitable for use with serial objects.
255.0 次下载
更新时间 2018/2/20

查看许可证

The matlab serial object can be used to connect to external devices that use serial communication, such as microcontrollers, GPS receivers, heartrate monitors, etc. In order to use a serial object, you need to know the serial port name.
GET_PORT_LIST returns a list of serial port names which are suitable for connections with serial port objects. The function is cross-platform (OS X, Linux, Windows) and does not require any Matlab toolboxes.
Example: (on OS X)

devices = get_port_list;
disp(devices)
'A700elGZ' '/dev/tty.usbserial-A700elGZ'
'PXFARNQU' '/dev/tty.usbserial-PXFARNQU'
Example: (on Windows)

devices = get_port_list;
disp(devices)
'6' 'COM6'
'1' 'COM1'
device_connection = serial(devices{1,2});
fopen(device_connection);
% send/receive data, etc
fclose(device_connection);

引用格式

M. A. Hopcroft (2024). Get Port List (https://www.mathworks.com/matlabcentral/fileexchange/56051-get-port-list), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2015b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Use COM Objects in MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.11.0.0

Typo fix

1.3.0.0

Include additional device entries for Mac, Linux

1.1.0.0

Fix device ID typo

1.0.0.0