Be the first to rate this file! 34 downloads (last 30 days) File Size: 2.36 KB File ID: #20892

Display Cursor Location

by Rodney Thomson

 

29 Jul 2008 (Updated 30 Jul 2008)

Code covered by BSD License  

Display cursor coordinates within a plot axes window

Download Now | Watch this File

File Information
Description

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

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
30 Jul 2008

Link to blog entry

Tag Activity for this File
Tag Applied By Date/Time
annotation Rodney Thomson 22 Oct 2008 10:12:16
customization Rodney Thomson 22 Oct 2008 10:12:16
windowbuttonmotionfcn Rodney Thomson 22 Oct 2008 10:12:16
plot Rodney Thomson 22 Oct 2008 10:12:16
display Rodney Thomson 22 Oct 2008 10:12:16
cursor Rodney Thomson 22 Oct 2008 10:12:16
cursor location Rodney Thomson 22 Oct 2008 10:12:16
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com