Path: news.mathworks.com!not-for-mail
From: "ching l" <chinglnc@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: repetitive counter (GUI)
Date: Mon, 13 Jul 2009 20:38:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <h3g5v9$6ep$1@fred.mathworks.com>
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 1247517481 6617 172.30.248.38 (13 Jul 2009 20:38:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 13 Jul 2009 20:38:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1438759
Xref: news.mathworks.com comp.soft-sys.matlab:555141


handles = guidata(gcbo); 

if(handles.count <= 2) 

handles.count= handles.count+1;
handles.count


else
    
    set(hObject, 'enable', 'off') % switch off button when the limit reach


end

Hi there

I would like the unable/off the push button when the counter reach 2, however, 
the counter goes from counter= 1, counter = 2, counter = 3, counter= 3

What is the reason counter =3 is repeated twice? Is there a way to avoid the last counter to repeat twice? 

Any advice would be much appreciated.

Thanks.