File Exchange

image thumbnail


version (7.09 KB) by Jonathan Lister
DTMCURSOR implements a cross hair with the ability to set and measure values from x and/or y datums.


Updated 29 Oct 2013

View Version History

View License

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.

Cite As

Jonathan Lister (2021). dtmcursor (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)


Excellente and very functional! Thank you

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];

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 ;)


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.

Jonathan Lister

Previous comment applies to the next revision...

Jonathan Lister

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

Jonathan Lister

Yet another update on the way...

Jonathan Lister

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

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

Community Treasure Hunt

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

Start Hunting!