image thumbnail


version (2.79 KB) by Jose Pina
Track mouse position and show coordinates in figure title.


Updated 01 Jun 2007

View License

Editor's Note: This was a File Exchange Pick of the Week

GTRACK Track mouse position and show coordinates in figure title.

Once GTRACK is active the mouse position is constantly tracked and printed on the current figure title. A left-click will print the coordinates in the command line and store them. Clicking the mouse right button deactivates GTRACK.

gtrack() tracks the mouse and prints coordinates in the command line.

clickData = gtrack() will return the click positions in clickData using UIWAIT. Matlab will be in wait mode until the user finishes clicking.

gtrack('newVar') tracks the mouse and creates a new variable in the base workspace called 'newVar' with the click coordinates. This mode does not use UIWAIT.

gtrack([],titleFormat) uses titleFormat as the format string for printing the mouse coordinates in the title.

Cite As

Jose Pina (2021). GTRACK (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP3
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: MATLAB Plot Tracing Utility

Inspired: Mouse Activity Tracking

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!