how to run a while loop until esc is pressed?

8 ビュー (過去 30 日間)
Orel Levy
Orel Levy 2017 年 10 月 23 日
コメント済み: Orel Levy 2017 年 10 月 24 日
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?

採用された回答

Jos (10584)
Jos (10584) 2017 年 10 月 23 日
I, the author of stoploop, suggest the function STOPLOOP: https://uk.mathworks.com/matlabcentral/fileexchange/20455
;)
  1 件のコメント
Orel Levy
Orel Levy 2017 年 10 月 24 日
thanks, that did it :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by