Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!not-for-mail
From: dpb <none@non.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: repetitive counter (GUI)
Date: Tue, 14 Jul 2009 18:46:59 -0500
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <h3j5kc$9je$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> <h3i1jj$r9o$1@news.eternal-september.org> <h3i1oe$q5s$1@fred.mathworks.com> <h3itgh$cs9$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+56fs7d4vtXb+r3BzcOI66wn/FE9BBrcNdtqMy4Wg4E3YAn6i0dO39EuHDuD0muMNtiAnJOX2BnQ0vSgpEaq06MF6zK7MHpP/10C5pzo7lQDolbhXiWmm8
X-Complaints-To: abuse@eternal-september.org
NNTP-Posting-Date: Tue, 14 Jul 2009 23:50:38 +0000 (UTC)
In-Reply-To: <h3itgh$cs9$1@fred.mathworks.com>
X-Auth-Sender: U2FsdGVkX1/4kl4UmhxbREQ0XCuzqd3Qo44YiH2pnXQ=
Cancel-Lock: sha1:wh+7wtr8fFYIF2G1CPNUWjQgWSk=
User-Agent: Thunderbird 2.0.0.22 (Windows/20090605)
Xref: news.mathworks.com comp.soft-sys.matlab:555510


ching l wrote:
...
> handles = guidata(gcbo); 
> if(handles.count<=2) 
>   handles.count= handles.count+1;
>   handles.count= count
> else 
>   set(hObject, 'enable', 'off') 
> end
> guidata(gcbo, handles);
> ...
> handles.randValue=299+handles.count;
> play= handles.randvalue
> ...
> 
> --------------------
> The results are
> 
> count= 0     play= 300 ;
> count= 1     play= 301 ;
> count = 2    play = 302 ;
> play= 302 ;  disable button
> 
> ----------------------
> 
> what I want is 
> count= 0     play= 300 ;
> count= 1     play= 301 ;
> count = 2    play = 302 ;
> disable button
> 
> can anyone tell me whether my logic is not right or the codes are not right?

Not from this, no--there's no way the output you've listed could have 
been generated from this code -- one needs _PRECISELY_AND_IDENTICALLY_, 
_WITHOUT_ANY_EDITING_ for presentation the code that generated the 
output, also not edited...

For example, the output says "count" but the line w/o a semicolon is

 > handles.count= count

which would display "handles.count = 0" assuming count is 0 on entry.

Perhaps, in fact, therein is part of the problem--you increment
handles.count and then set it to count which will in essence undoes the 
increment operation.

I suspect your problems are tied in with this problem...

--