Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Event Object for Datacursormode
Replies: 7   Last Post: Dec 30, 2012 11:05 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,945
Registered: 12/7/04
Re: Event Object for Datacursormode
Posted: Dec 30, 2012 11:05 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Nima Nikvand" <nnikvand@uwaterloo.ca> wrote in message
> 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))]};
> setappdata(handles.figure1,'img',pos);
> %setappdata(handles.figure2,'txtx',txt);
> end
> 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.

Set a breakpoint on the first line of the datatextbox function then attempt
to reproduce the error. Step through the function until it throws the error.
Determine why the error occurs and fix it.

Alternately, instead of using handles.figure1, use ANCESTOR on the Target
property of the event_obj object to retrieve its figure ancestor.


"Handle of the object the data cursor is referencing (the object which
you click, for example, a line or a bar from a series)"

You can then set its application data or use GUIDATA to share whatever
information you want.

Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.