File Exchange Pick of the Week

Our best user submissions

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the Original version of the page.

Get your key press

Posted by Jiro Doke,

Jiro‘s pick this week is getkey by Jos.

Here’s an entry from a long-time user. Honestly speaking, I’m surprised why this entry has not been Picked yet. It was initially posted in 2005. It’s a straight-forward tool that accomplishes something that I often need to do, which is to get user keyboard input. When I am developing an app, then I can make use of KeyPressFcn or WindowKeyPressFcn. But if I don’t have a figure window, it becomes a bit tricky. Jos’s getkey makes it easy for me. It actually creates an invisible figure to capture the key input. It’s a modal figure so it doesn’t lose focus. The simplest syntax is this

ch = getkey;

with additional syntax for extra useful features.

Thanks for making things easier, Jos!


Give it a try and let us know what you think here or leave a comment for Jos.

Get the MATLAB code

Published with MATLAB® R2018b


Comments are closed.