From: Jackson on 10 Jun 2010 13:15 Hi, i'm new here. I have the following problem, hopefully somebody can help me. I made a "minimal code". The Problem is that every time the event is thrown the slider_call callback function is executed, but the propertie testvalue won't ne change. When the callback ist executed for a second time der propertie values are set back again to the ones with which the object was constructed. classdef testslide properties slider; testvalue; end methods function this=testslide() this.slider=uicontrol('Style','Slider'); this.testvalue=0; addlistener(this.slider,'Action',@(src,evnt)slider_call(this,src,evnt)); end function slider_call(this,src,evnt) disp(['before' num2str(this.testvalue)]); %always 0 this.testvalue=this.testvalue+1; disp(['afer' num2str(this.testvalue)]); %always 1 end end end
From: Rich Ellis on 10 Jun 2010 17:45 Search for, "Example - Class Method as a Slider Callback" in the MATLAB documentation. "Jackson " <big_jim_sladelol(a)gmx.de> wrote in message news:hur6j9$7lv$1(a)fred.mathworks.com... > Hi, > i'm new here. I have the following problem, hopefully somebody can help > me. > > I made a "minimal code". The Problem is that every time the event is > thrown the slider_call callback function is executed, but the propertie > testvalue won't ne change. When the callback ist executed for a second > time der propertie values are set back again to the ones with which the > object was constructed. > > > classdef testslide > properties > slider; > testvalue; > end > methods > function this=testslide() > this.slider=uicontrol('Style','Slider'); > this.testvalue=0; > > addlistener(this.slider,'Action',@(src,evnt)slider_call(this,src,evnt)); > end > function slider_call(this,src,evnt) > disp(['before' num2str(this.testvalue)]); %always 0 > this.testvalue=this.testvalue+1; > disp(['afer' num2str(this.testvalue)]); %always 1 > end > end > end
From: Jackson on 11 Jun 2010 12:37 "Rich Ellis" <rich(a)mathworks.com> wrote in message <hurme5$1f6$1(a)fred.mathworks.com>... > > Search for, "Example - Class Method as a Slider Callback" in the MATLAB > documentation. > > "Jackson " <big_jim_sladelol(a)gmx.de> wrote in message > news:hur6j9$7lv$1(a)fred.mathworks.com... > > Hi, > > i'm new here. I have the following problem, hopefully somebody can help > > me. > > > > I made a "minimal code". The Problem is that every time the event is > > thrown the slider_call callback function is executed, but the propertie > > testvalue won't ne change. When the callback ist executed for a second > > time der propertie values are set back again to the ones with which the > > object was constructed. > > > > > > classdef testslide > > properties > > slider; > > testvalue; > > end > > methods > > function this=testslide() > > this.slider=uicontrol('Style','Slider'); > > this.testvalue=0; > > > > addlistener(this.slider,'Action',@(src,evnt)slider_call(this,src,evnt)); > > end > > function slider_call(this,src,evnt) > > disp(['before' num2str(this.testvalue)]); %always 0 > > this.testvalue=this.testvalue+1; > > disp(['afer' num2str(this.testvalue)]); %always 1 > > end > > end > > end > Thanx a lot, well the problem was that it had to be a handle class.
|
Pages: 1 Prev: Do GUIDE Gui's have handles? Next: average every n rows of data in a timeseries |