MGetKey

Return the keyboard/mouse button code over figure.

You are now following this Submission

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://in.mathworks.com/matlabcentral/fileexchange/25792-mgetkey), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0