Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Can I use MATLAB to communicate with a Serial Port and/or a Virtual Serial (USB-to-Serial) Port?

Asked by Ankit Desai

Ankit Desai

on 17 Mar 2011
Accepted Answer by Ankit Desai

Ankit Desai

Is it possible to communicate with a Serial Port either built-in to my computer or a Virtual Serial Port (USB-to-Serial adaptor) from MATLAB? If yes, where can I find more information regarding serial communication from MATLAB?


Ankit Desai

Ankit Desai


1 Answer

Answer by Ankit Desai

Ankit Desai

on 17 Mar 2011
Accepted answer

You can use MATLAB to talk to your computer's serial port on any of the MATLAB's supported operating system. All the details on how to do so can be found on this documentation page. The documentation explains how to connect, configure, communicate (read and write) and control the serial port.

As for the Virtual Serial Ports - such as a USB-to-Serial adaptor. Most such USB adaptors (dongles) should show up and work as a serial port in MATLAB.

A word of caution though that not all USB-to-Serial adaptors (and their drivers) emulate an on-board serial port exactly. The better the adaptor emulate the on-board serial port, the better performance (reliable and robust) you will get.

Note: When using virtual serial ports remember to restart MATLAB, once you plug in the adaptor, for the new port to show up in MATLAB. This is to allow the underlying serial API to update the list of available serial ports.

In case you would like to read more on serial port, the MATLAB online documentation has a really nice chapter on serial port overview.




on 5 Feb 2013


could you update the documentation page please?? that would be very helpful.. thank you

Ankit Desai

Ankit Desai

Contact us