필터 지우기
필터 지우기

How to handle fopen error preventing the script to stop?

조회 수: 1 (최근 30일)
Andrea Bettati
Andrea Bettati 2019년 5월 4일
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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by