Effacer les filtres
Effacer les filtres

Matlab blocks arduino comport

3 vues (au cours des 30 derniers jours)
Dennis Weber
Dennis Weber le 11 Déc 2017
Commenté : Dennis Weber le 11 Déc 2017
Hi all,
I am using matlab (Matlab App Designer to be precise) to communicate with my arduino via serial communication. My code works fine the first time I start the app. If I restart the app, Matlab gives me the following error code:
if true
Error using serial/fopen (line 72)
Open failed: Port: COM4 is not available. No ports are available.
Use INSTRFIND to determine if other instrument objects are connected to the requested
device.
end
If have already tried 'clear all' afterwards, but my COMPORT still seems to be busy. I have to restart matlab to get the app running again.
Do you have any idea how this can be solved?

Réponse acceptée

Madhu Govindarajan
Madhu Govindarajan le 11 Déc 2017
I would recommend something along the lines of cleanup that happens when someone closes the App where you can use this - https://www.mathworks.com/help/matlab/ref/serial.delete.html
The other thing I think might help is this function here - https://www.mathworks.com/help/instrument/instrreset.html
which should delete all open instrument objects as per the doc.
HTH
  1 commentaire
Dennis Weber
Dennis Weber le 11 Déc 2017
Thanks, the first part worked!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Support Package for Arduino Hardware dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by