Filter löschen
Filter löschen

How to handle fopen error preventing the script to stop?

1 Ansicht (letzte 30 Tage)
Andrea Bettati
Andrea Bettati am 4 Mai 2019
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

Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by