View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

  • dtmcursordtmcursor implements a crosshair with the ability to set and measure values from x or y datums.
  • View all files
Be the first to rate this file! 6 Downloads (last 30 days) File Size: 7.09 KB File ID: #42675 Version: 1.8
image thumbnail




18 Jul 2013 (Updated )

DTMCURSOR implements a cross hair with the ability to set and measure values from x and/or y datums.

| Watch this File

File Information

Datum Cursor (DTMCURSOR) provides a graphical evaluation tool that produces a crosshair that displays its location in a figure annotation for quick inspection of data values. The user can also define x and/or y datums and measurement lines to calculate differences quickly. The difference is displayed either above or to the right of each measurement line. All text objects, except for datum labels, can be re-positioned via mouse. Changing datum location causes all measurements to update. Delta_y text font and edge color is the color of the line that you added a measurement to. Datums and measurement lines are draggable. I've tried to blend all the best of what I've learned from the submissions that inspired me. Many great features... give it a try. I hope you will find it to be "the" tool for data exploration.


Plot Crosshairs, Dualcursor, Graphical Data Selection Tool, and Display Cursor Location inspired this file.

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
26 Oct 2013 Jonathan Lister


Add this case to the keypress function for the feature you requested. I'll submit it to the FEX if this is what you're looking for.

case 'm'
%return all the x and y measurements to caller
xdt = get(this.xdatum,'XData');
ydt = get(this.ydatum,'YData');

if ~isempty(xdt)
xd = xdt(1);
xd = [];

if ~isempty(ydt)
yd = ydt(1);
yd = [];

%collect all x measurement values
nx = numel(this.xmline);
xm = zeros(1,nx);
for i=1:nx
x = get(this.xmline(i),'xdata');
xm(i) = x(1);

%collect all y measurement values (non-scaled)
ny = numel(this.ymline);
ym = zeros(1,ny);
for i=1:ny
y = get(this.ymline(i),'ydata');
ym(i) = y(1);

sf = this.ScaleFactor;
ys = (ym-sf{2})/sf{1};

% return column vectors with the datum as fist
% value in vector followed by all measurement
% locations
y = [yd ys];
x = [xd xm];

Comment only
26 Oct 2013 Jonathan Lister

Kostas, I will try to look into your suggestion. Most of my development time has been with another language lately. I'd apreciate a good rating... might help me be motivated ;)

Comment only
21 Oct 2013 Kostas

Kostas (view profile)

Thanks for this nice tool. Is there any way to export the x- and/or y- axis measurements to a workspsace variable? I believe that this is a must-have functionality.

Comment only
24 Jul 2013 Jonathan Lister

Previous comment applies to the next revision...

Comment only
24 Jul 2013 Jonathan Lister

When dtmcursor is on you can type Shift+n to toggle SnapToNearest on/off

Comment only
19 Jul 2013 Jonathan Lister

Yet another update on the way...

Comment only
18 Jul 2013 Jonathan Lister

A significant update has been submitted and should be available soon.

Comment only
18 Jul 2013 1.1

Added labels to the X and Y datums. I had a dependency on a function called "draggable" that I eliminated. Cursor and delta value text can now be re-positioned by dragging with mouse.

19 Jul 2013 1.2

Added many new properties, all text except for datum labels can be re-positioned via mouse. SnapToNearest causes the crosshair to be constrained to the closest line value. Use set(obj,'SnapToNearest',false) to turn that feature off.

22 Jul 2013 1.3

corrected some comments in the file

31 Jul 2013 1.5

Added Keypress commands to control SnapToNearest and crosshair visability. Made datums and measurement lines draggable. Changed the default line and edge colors to red. Changed the default line style to solid.

05 Aug 2013 1.6

Cursors can snap to data... delta-y can change color, added static methods, case insensitive parameter value pair input.

29 Oct 2013 1.8

Added ability to export datum and measurement line locations to the base work space as vectors x_pos and y_pos.

Contact us