From: dpb <none@non.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: repetitive counter (GUI)
Date: Tue, 14 Jul 2009 08:26:28 -0500
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <h3i1jj$r9o$1@news.eternal-september.org>
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> <h3i04f$90p$1@fred.mathworks.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.eternal-september.org U2FsdGVkX1/aFCvUXnBhHHLsx7bQkGYkeIQWHEATKMKhsmj3CpLaVHkkoGycbJ5ntOdb5jcziHV9uvUDfJ7lYeMKI/lr1hQIYGE+VzD6VvwLcJ01vnn1/VMIgrR34EqurxA4mxbkse3jFZ62qHHgnw==
X-Complaints-To: abuse@eternal-september.org
NNTP-Posting-Date: Tue, 14 Jul 2009 13:35:49 +0000 (UTC)
In-Reply-To: <h3i04f$90p$1@fred.mathworks.com>
X-Auth-Sender: U2FsdGVkX1/wTWRm1EC97Uk8AKUnJSvZ6OdagaXYaWw=
Cancel-Lock: sha1:4TH6clS6+9RzPfpB0QtKyEIM6LM=
User-Agent: Thunderbird 2.0.0.22 (Windows/20090605)
Path: news.mathworks.com!newsfeed-00.mathworks.com!oleane.net!oleane!feed.ac-versailles.fr!gegeweb.org!feeder.eternal-september.org!eternal-september.org!not-for-mail
Xref: news.mathworks.com comp.soft-sys.matlab:555327


ching l wrote:
> 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?

OK, I didn't look at the output; I thought the question was "why 3"?

Hmmm....that's not clear to me from the posted code, either.

Are you sure there isn't something not in this code that took one off it 
or another line that outputs it on that condition?

The code in isolation does appear that the 2nd "3" shouldn't be displayed.

I gather this is somehow called from a GUI?  I've never written a single 
ML GUI interface (and hope to continue that record :) ) -- perhaps 
there's something about events that there's another in the queue or 
something related to the GUI portion; that's out of my realm...

--