How to handle fopen error preventing the script to stop?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!