Date: Dec 30, 2012 3:08 PM
Author: Nima Nikvand
Subject: Re: Event Object for Datacursormode

Hello Matt,

Thanks for your replies to both my posts. I modified my datatextboxfunction as follows to store my desired variables in figure handles:

function [txt,pos] = datatextbox(~,event_obj,ancestor)
pos = get(event_obj,'Position');

txt = {['Vector Length: ',num2str(pos(1))],...
['MOS: ',num2str(pos(2))]};


However, now my data tip is not showing the correct information (Vector length and Mos) , and shows Error in Custom data tip function instead. When I remove the setappdata function it starts working again.

"Matt J" wrote in message <kbosk1$b1q$>...
> "Matt J" wrote in message <kbon7f$njj$>...
> > "Nima Nikvand" <> wrote in message <kboj05$ahe$>...
> > >
> > > function [txt,pos] = datatextbox(~,event_obj)
> > >
> > > and this works very well. However, I'd like to be able to get the output of my datatextbox function and I was wondering if I can some how call the function directly by passing the event_obj to it. I'd greatly appreciate your suggestions, or any other solutions to get the output arguments.

> > =============
> >
> > If you make datatextbox a nested function, every variable in its workspace will also be available in the workspace in which it is nested.

> You could also call setappdata from within datatextbox and store the txt,pos output data to the parent figure. Pass the figure handle to datatextbox using this syntax
> set(dcmObj,'UpdateFcn',{@datatextbox, ancestor(dcmObj,'figure')});
> Then use getappdata to pull it out later.