Mercurial > hg > ltpda
diff m-toolbox/classes/+utils/@plottools/datacursormode.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/+utils/@plottools/datacursormode.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,21 @@ + + +function output_txt = datacursormode(obj, event_obj) +% Display the position of the data cursor +% obj Currently not used (empty) +% event_obj Handle to event object +% output_txt Data cursor text string (string or cell array of strings). + +t0 = get(get(get(event_obj, 'Target'), 'Parent'), 'UserData'); + +pos = get(event_obj,'Position'); + +output_txt = {['X: ',char(t0 + pos(1))],... + ['Y: ',num2str(pos(2),4)]}; + +% If there is a Z-coordinate in the position, display it as well +if length(pos) > 2 + output_txt{end+1} = ['Z: ',num2str(pos(3),4)]; +end + +output_txt{end+1} = ['x-value: ', num2str(pos(1),4)];