how to run a while loop until esc is pressed?
조회 수: 3 (최근 30일)
이전 댓글 표시
I need to run a loop that reads data off a serial port until i want to break it. i am using: {while true out = fscanf(obj); data_vec = sscanf(out,formatSpec, [1,130]); [w_vec,acc_vec] = IMU_DATA(data_vec); W = [W,w_vec]; ACC = [ACC,acc_vec]; end} I was wondering how can i use a callback function to stop the loop when i hit the esc key, without using ctrl +C?
댓글 수: 0
채택된 답변
Jos (10584)
2017년 10월 23일
I, the author of stoploop, suggest the function STOPLOOP: https://uk.mathworks.com/matlabcentral/fileexchange/20455
;)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!