Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Check keyboard without stopping?

Subject: Check keyboard without stopping?

From: Chuck37

Date: 24 Apr, 2013 00:28:09

Message: 1 of 2

I have a huge simulation that takes a long time to run, so I watch in real time. I'd like a way to get into debug mode when needed, but not have to press continue every iteration. I was hoping to be able to poll the keyboard at each iteration to see if a key is pressed. If so, I could go into a dummy section of code (e.g. pause(0)) and have a breakpoint there so I could examine variables, etc. If a key wasn't pressed I could sit back and watch the simulation until something unusual happened.

Is it possible? Or maybe there's a feature of the debugger that does this some other way?

Subject: Check keyboard without stopping?

From: Bruno Luong

Date: 24 Apr, 2013 07:02:09

Message: 2 of 2

"Chuck37" wrote in message <kl78up$nm1$1@newscl01ah.mathworks.com>...
> I have a huge simulation that takes a long time to run, so I watch in real time. I'd like a way to get into debug mode when needed, but not have to press continue every iteration. I was hoping to be able to poll the keyboard at each iteration to see if a key is pressed. If so, I could go into a dummy section of code (e.g. pause(0)) and have a breakpoint there so I could examine variables, etc. If a key wasn't pressed I could sit back and watch the simulation until something unusual happened.
>
> Is it possible? Or maybe there's a feature of the debugger that does this some other way?

You can do within a figure/gui by using KeyPressFcn callback (and mouse button and so on). I never figure out how to do in command line.

Bruno

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us