Azzera filtri
Azzera filtri

How to handle fopen error preventing the script to stop?

1 visualizzazione (ultimi 30 giorni)
Hi to you all,
I'm using matlab to communicate with a microcontroller and send data over UART.
To initialize the serial communication I use fopen. The problem is that oftet I plug and unpload the board from my computer and the port changes.
under Linux I see either ttyACM1 or ttyACM2.
When Matlab does not ind the port i got this
Error using serial/fopen (line 72)
Open failed: Port: /dev/ttyACM1 is not available. Available ports: /dev/ttyACM0, /dev/ttyS4.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.
Error in initialize_NXP (line 14)
fopen(serial_object);
And the script stops. Is there a way to handle this and call fopen on ttyACM2?
BR,
Andrea

Risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by