Question

I'm trying to follow this guide on sending data from an arduino to a MATLAB program. I have every piece of code exactly matching the code in the example. However, whenever I attempt to start up the MATLAB program, I get the error message:

Error using serial/fopen (line 72) Open failed: Port: COM3 is not available. Available ports: COM1. Use INSTRFIND to determine if other instrument objects are connected to the requested device.

Error in Untitled8 (line 2) fopen(arduino)

Can anyone help me figure out how to get this working?

EDIT: My arduino is printing to COM3, so if I want MATLAB to hear it, it also needs to be COM3.

Was it helpful?

Solution

If I understand correctly you are using the Arduino IDE/Monitor to communicate with your Arduino on COM3. You want to have Matlab connect to the Arduino.

Since RS-232 is a point to point methology, you can only have one program/device on each end unless you add a bunch of hijinks.

When you have the Arduino IDE/Monitor open it uses the com port and other programs are denied access.

I think you need to close the Arduino monitor program to release Com port 3 and then the Matlab program should be able to open the port.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top