Date: Dec 30, 2012 2:56 AM
Author: Matt J
Subject: Re: Datacursormode for GUI with two Axes

"Nima Nikvand" <nnikvand@uwaterloo.ca> wrote in message <kbom05$jsm$1@newscl01ah.mathworks.com>...
>
> dcmObj=datacursormode(handles.figure1);
>
> set(dcmObj,'Enable','on',...
> 'SnapToDataVertex','on', ...
> 'DisplayStyle','datatip',...
> 'UpdateFcn',@datatextbox);
> p = ancestor(dcmObj,'axes')
>
> however p is returning an empty matrix (p=[]). I'd greatly appreciate your suggestions.


You can't get the axis from the dcmObj. The dcmObj is a child of the figure, not any of the axes.

Call GCA inside datatextbox and return its output using nested functions, as I described in your other post.