MATLAB Answers

Q Liao

waitforbuttonpress do not respond to keyboard

Asked by Q Liao
on 29 Jun 2013

Hi all,

I have a program that calls waitforbuttonpress very frequently. (about 4 times per second). After running it for some time, the waitforbuttonpress becomes not responsive to keyboard activities and it only responds to mouse clicks. Does anybody know why? Is there any way to fix it?

Thank you very much in advance!

Best, Liao

  1 Comment

In fact, it is the whole matlab process that becomes unresponsive to keyboard activities. I can't even type any command in the matlab shell, nor edit a .m file. I'm using Matlab 2012a in 64-bit Ubuntu 12.04.

1 Answer

Answer by Guru
on 3 Jul 2013

Is there a reason you chose to use waitforbuttonpress if you are doing it that frequently??

A much easier and better solution would be to replace all your calls of waitforbuttonpress and change it to




Join the 15-year community celebration.

Play games and win prizes!

Learn more
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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!