Path: news.mathworks.com!not-for-mail
From: "ching l" <chinglnc@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: repetitive counter (GUI)
Date: Tue, 14 Jul 2009 13:10:39 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 45
Message-ID: <h3i04f$90p$1@fred.mathworks.com>
References: <h3g5v9$6ep$1@fred.mathworks.com> <h3g6rd$58f$1@fred.mathworks.com> <h3g7ie$mr4$1@fred.mathworks.com> <h3g8bd$lin$1@news.eternal-september.org> <h3hbh5$ljn$1@fred.mathworks.com> <h3hgfb$96h$1@news.eternal-september.org>
Reply-To: "ching l" <chinglnc@hotmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1247577039 9241 172.30.248.38 (14 Jul 2009 13:10:39 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 14 Jul 2009 13:10:39 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1438759
Xref: news.mathworks.com comp.soft-sys.matlab:555322


dpb <none@non.net> wrote in message <h3hgfb$96h$1@news.eternal-september.org>...
> ching l wrote:
> > dpb <none@non.net> wrote in message <h3g8bd$lin$1@news.eternal-september.org>...
> >> ching l wrote:
> >> ....
> >>> it does increase but it didn't stop at 2. It increases till 3 and
> >>> repeat counter=3 again.
> >>>
> >>> Any idea why?
> >>>
> >> ...
> >>>> "ching l" <chinglnc@hotmail.com> wrote in message
> >>>> <h3g5v9$6ep$1@fred.mathworks.com>...
> >>>>> handles = guidata(gcbo);
> >>>>> if(handles.count <= 2)
> >>>>>   handles.count= handles.count+1; handles.count
> >>>>> else
> >>>>>  set(hObject, 'enable', 'off') % switch off button 
> >>>>> end
> >> ...
> >>
> >> [Top posting repaired...please don't do that; it makes following the 
> >> conversation much more difficult...]
> >>
> >>  > it does increase but it didn't stop at 2. It increases till 3 and
> >>  > repeat counter=3 again.
> >>  >
> >>  > Any idea why?
> >>
> >> As it happens, yes... :)
> >>
> >> What happens in your logic when enter the function w/ handles.count==2?
> >>
> > 
> > Guess what, the results is the same :-(
> > 
> > I'm not sure why...
> 
> Pretend you're the computer executing the code you provided.  Work thru 
> line by line w/ what you've told it to do if you start w/ a given value 
> for count (specifically, 2).
> 
> --Thanks.  I understand why it increases to 3 now, but I suppose it should jump to the "else" section when the counter reaches 3 and not repeating the counter again?

Counter= 3 occurs twice. Which part did I miss again?