From: Christopher Schwarz on
I am trying to edit the data cursor to display basically (x,y,variable) where 'variable' is the 3rd dimension I am plotting. So essentially I am trying to do this:

figure;
pcolor(double(x),double(y),double(variable))
colormap
xlabel('.....')
ylabel('.....')
title('.......')

I would like to edit in datacursormode to display the name 'variable': and then the value at that point. I would greatly appreciate any help with this.

Chris
From: ImageAnalyst on
I'd see if you can put a call to text() within the mousemove callback.
From: Christopher Schwarz on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <91f2fa9f-0282-4d7f-8b85-003d0250f94e(a)d33g2000vbu.googlegroups.com>...
> I'd see if you can put a call to text() within the mousemove callback.

function output_txt = myfunction1(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).


pos = get(event_obj,'Position');

output_txt = {['X: ',num2str(pos(1),4)],...
['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} = ['dBZ: ',num2str(pos(3),4)];
end

I found this on the Mathworks website as an example and it says further modification of the code can be made to display properties of data, but I am not quite sure how to do this since it didn't elaborate on it.
Could you elaborate a bit more on what you are referring to? Thanks a bunch.
From: ImageAnalyst on
I don't know - I've never done it. GUIDE is so lame that it doesn't
expose many of the events. For example, with an axes, there is no
mouse move event exposed. For the main figure, there is a
WindowButtonMotionFcn callback and it does go in there when you move
the mouse around but I was unable to get it to display text anywhere
on the figure using the text() command. What I thought I could do was
to get the mouse position and then see if it lied in the axes, and if
it did, figure out the axes position somehow and display if. But I
couldn't even get any text to appear anywhere. I even checked the
units to make sure that the numbers were valid (e.g. figure units were
'normalized' and I made sure I was passing x and y that were between 0
and 1.)

Perhaps you can find out how to do it via Yair's blog:
http://undocumentedmatlab.com/blog/undocumented-mouse-pointer-functions/
From: Christopher Schwarz on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <3228214a-0f5b-42c4-8546-4cc41b797115(a)11g2000yqr.googlegroups.com>...
> I don't know - I've never done it. GUIDE is so lame that it doesn't
> expose many of the events. For example, with an axes, there is no
> mouse move event exposed. For the main figure, there is a
> WindowButtonMotionFcn callback and it does go in there when you move
> the mouse around but I was unable to get it to display text anywhere
> on the figure using the text() command. What I thought I could do was
> to get the mouse position and then see if it lied in the axes, and if
> it did, figure out the axes position somehow and display if. But I
> couldn't even get any text to appear anywhere. I even checked the
> units to make sure that the numbers were valid (e.g. figure units were
> 'normalized' and I made sure I was passing x and y that were between 0
> and 1.)
>
> Perhaps you can find out how to do it via Yair's blog:
> http://undocumentedmatlab.com/blog/undocumented-mouse-pointer-functions/

Hmmmm, I am not having much luck with this. Anyone have any suggestions?