Connecting to a serial port which is used by another application

3 views (last 30 days)
Hi! I have an application that I use to communicate with another computer through serial port (COM10). I want to use Matlab to see the data being sent by my other application. But I always get this error
Cannot connect to the COM10 port. Possible reasons are another application is connected to the port or the port does not exist.
Is there a way for me to view the data being sent by my other application?

Answers (1)

Guillaume
Guillaume on 27 Sep 2014
Edited: Guillaume on 27 Sep 2014
Not without special drivers that let you intercept the serial communication. This applies to any windows application, not just matlab. A serial port is exclusive to the application that opens it.
On 32-bit windows you can use vspe to split a physical port into two virtual ones. On 64-bit, I believe com0com may let you do this.
Otherwise, you can also make or buy a splitter cable.
Final option, (I've done this in the past with com0com but not in matlab) is to create a virtual serial pair , have your application talk to one end of the pair and matlab at the other end and within matlab, redirect all traffic to/from the physical port while also capturing it.

Community Treasure Hunt

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

Start Hunting!