MGetKey

Return the keyboard/mouse button code over figure.
484 Downloads
Updated 10 Nov 2009

View License

ch = MGetKey(hFig) waits for keyboard/mouse button event over the specified figure handle (hFig) and returns the ascii code of the keyboard key or -1 if a mouse button was pressed (ch). An empty value is returned if an error occurs.

Unlike the (nice) getkey.m script, MGetKey does not need an auxiliary window.

Cite As

Marcello Ferro (2026). MGetKey (https://uk.mathworks.com/matlabcentral/fileexchange/25792-mgetkey), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Argument Definitions in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0