Date: Dec 30, 2012 1:12 AM
Author: Nima Nikvand
Subject: Datacursormode for GUI with two Axes

Hello everyone,

I have a GUI with two axes, which are supposed to display two different plots, and I will be using datacursormode to get the information for the plots. I understand it is not possible to enable datacursormode for only one of the axes in my GUI, however, as suggested in previous questions, I was going to use ancestor function to figure out which one of the axes has been clicked on. Below is my general code:


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.