how to run a while loop until esc is pressed?

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?

 Accepted Answer

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Asked:

on 23 Oct 2017

Commented:

on 24 Oct 2017

Community Treasure Hunt

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

Start Hunting!