Display Cursor Location

Display cursor coordinates within a plot axes window

Vous suivez désormais cette soumission

Display the current cursor coordinates within the bounds of a plot axes.

Assigned as a WindowButtonMotionFcn callback function. Only updates when mouse is moved over plot contents.

To use (See screenshot):

t = linspace(-5,5);
y = sinc(t);
f = figure;
plot(t, y, 'r');

set(f, 'WindowButtonMotionFcn', @(obj, event)cursorLocation(obj, event, 'BottomLeft', ' X: %.3f\n Y: %.3f', 'r'))

For more information:
http://iheartmatlab.blogspot.com/2008/07/display-cursor-coordinates.html

Citation pour cette source

Rodney Thomson (2026). Display Cursor Location (https://fr.mathworks.com/matlabcentral/fileexchange/20892-display-cursor-location), MATLAB Central File Exchange. Extrait(e) le .

Remerciements

A inspiré : stackobj, dtmcursor

Catégories

En savoir plus sur Data Exploration dans Help Center et MATLAB Answers

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux
Version Publié le Notes de version Action
1.0.0.0

Link to blog entry