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: Problem with handles and continually updating plot in GUIDE
Replies: 5   Last Post: Aug 13, 2014 9:46 AM

Advanced Search

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

Posts: 1,166
Registered: 9/26/13
Re: Problem with handles and continually updating plot in GUIDE
Posted: Aug 13, 2014 9:46 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


"Alex " <alex_pitterss@hotmail.co.uk> wrote in message
news:lsf8ki$cn7$1@newscl01ah.mathworks.com...
> Actually, it seems this is part of the same problem. How would I update
> the listener
> handles.sliderListener =
> addlistener(handles.slider1,'ContinuousValueChange', ...
> @(hObject, event)
> slider1ContValCallback(...
> hObject, eventdata, handles));


You are still passing the COPY of the handles structure into
slider1ContValCallback. NO changes you make ANYWHERE to the handles
structure will change the copy being remembered by that anonymous function.
You can delete the handles structure entirely, and it WILL NOT CHANGE the
listener's copy.

If you want slider1ContValCallback to get the most up-to-date copy, retrieve
it INSIDE slider1ContValCallback instead of passing it into
slider1ContValCallback via anonymous function.

It's like you have a nametag labeled Bob attached to your chest by surgical
staples. You can change your name from Bob to whatever else you want -- but
people are going to look at that nametag and call you Bob. Instead of doing
that, let people ask you your name when they meet you. [Not a great
metaphor, but close enough.]

*snip*

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.