File Exchange

image thumbnail

dtmcursor

version 1.8 (7.09 KB) by

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

0 Downloads

Updated

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.

Comments and Ratings (7)

Jonathan Lister

@Kostas

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'
%TODO:
%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);
else
xd = [];
end

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

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

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

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];
assignin('base','x_pos',x)
assignin('base','y_pos',y)

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

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.

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.

Updates

1.8

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

1.6

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

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.

1.3

corrected some comments in the file

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.

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.

MATLAB Release
MATLAB 8.0 (R2012b)

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

» Watch video