<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034</link>
    <title>MATLAB Central Newsreader - repetitive counter (GUI)</title>
    <description>Feed for thread: repetitive counter (GUI)</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 13 Jul 2009 20:38:01 -0400</pubDate>
      <title>repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#664960</link>
      <author>ching l</author>
      <description>handles = guidata(gcbo); &lt;br&gt;
&lt;br&gt;
if(handles.count &amp;lt;= 2) &lt;br&gt;
&lt;br&gt;
handles.count= handles.count+1;&lt;br&gt;
handles.count&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
else&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set(hObject, 'enable', 'off') % switch off button when the limit reach&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
Hi there&lt;br&gt;
&lt;br&gt;
I would like the unable/off the push button when the counter reach 2, however, &lt;br&gt;
the counter goes from counter= 1, counter = 2, counter = 3, counter= 3&lt;br&gt;
&lt;br&gt;
What is the reason counter =3 is repeated twice? Is there a way to avoid the last counter to repeat twice? &lt;br&gt;
&lt;br&gt;
Any advice would be much appreciated.&lt;br&gt;
&lt;br&gt;
Thanks.</description>
    </item>
    <item>
      <pubDate>Mon, 13 Jul 2009 20:53:01 -0400</pubDate>
      <title>repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#664965</link>
      <author>Sven </author>
      <description>Follow through your code:&lt;br&gt;
&lt;br&gt;
If counter is 2 or lower, THEN increment &quot;counter&quot;.&lt;br&gt;
OTHERWISE (ie, if counter is 3 or higher), set enable to off.&lt;br&gt;
&lt;br&gt;
Does your program work as you intend it if you increment counter before checking if it's 2 or lower?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;ching l&quot; &amp;lt;chinglnc@hotmail.com&amp;gt; wrote in message &amp;lt;h3g5v9$6ep$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; handles = guidata(gcbo); &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if(handles.count &amp;lt;= 2) &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; handles.count= handles.count+1;&lt;br&gt;
&amp;gt; handles.count&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; else&lt;br&gt;
&amp;gt;     &lt;br&gt;
&amp;gt;     set(hObject, 'enable', 'off') % switch off button when the limit reach&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hi there&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I would like the unable/off the push button when the counter reach 2, however, &lt;br&gt;
&amp;gt; the counter goes from counter= 1, counter = 2, counter = 3, counter= 3&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What is the reason counter =3 is repeated twice? Is there a way to avoid the last counter to repeat twice? &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any advice would be much appreciated.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks.</description>
    </item>
    <item>
      <pubDate>Mon, 13 Jul 2009 21:05:18 -0400</pubDate>
      <title>repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#664968</link>
      <author>ching l</author>
      <description>&quot;sort of&quot;- &lt;br&gt;
&lt;br&gt;
it does increase but it didn't stop at 2. It increases till 3 and repeat counter=3 again.&lt;br&gt;
&lt;br&gt;
Any idea why?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Sven&quot; &amp;lt;sven.holcombe@gmail.deleteme.com&amp;gt; wrote in message &amp;lt;h3g6rd$58f$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Follow through your code:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If counter is 2 or lower, THEN increment &quot;counter&quot;.&lt;br&gt;
&amp;gt; OTHERWISE (ie, if counter is 3 or higher), set enable to off.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Does your program work as you intend it if you increment counter before checking if it's 2 or lower?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;ching l&quot; &amp;lt;chinglnc@hotmail.com&amp;gt; wrote in message &amp;lt;h3g5v9$6ep$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; handles = guidata(gcbo); &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; if(handles.count &amp;lt;= 2) &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; handles.count= handles.count+1;&lt;br&gt;
&amp;gt; &amp;gt; handles.count&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; else&lt;br&gt;
&amp;gt; &amp;gt;     &lt;br&gt;
&amp;gt; &amp;gt;     set(hObject, 'enable', 'off') % switch off button when the limit reach&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Hi there&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I would like the unable/off the push button when the counter reach 2, however, &lt;br&gt;
&amp;gt; &amp;gt; the counter goes from counter= 1, counter = 2, counter = 3, counter= 3&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; What is the reason counter =3 is repeated twice? Is there a way to avoid the last counter to repeat twice? &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Any advice would be much appreciated.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks.</description>
    </item>
    <item>
      <pubDate>Mon, 13 Jul 2009 21:09:33 -0400</pubDate>
      <title>Re: repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#664972</link>
      <author>dpb</author>
      <description>ching l wrote:&lt;br&gt;
....&lt;br&gt;
&amp;gt; it does increase but it didn't stop at 2. It increases till 3 and&lt;br&gt;
&amp;gt; repeat counter=3 again.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any idea why?&lt;br&gt;
&amp;gt; &lt;br&gt;
...&lt;br&gt;
&amp;gt;&amp;gt; &quot;ching l&quot; &amp;lt;chinglnc@hotmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt;&amp;gt; &amp;lt;h3g5v9$6ep$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; handles = guidata(gcbo);&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; if(handles.count &amp;lt;= 2)&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;   handles.count= handles.count+1; handles.count&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; else&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;  set(hObject, 'enable', 'off') % switch off button &lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; end&lt;br&gt;
...&lt;br&gt;
&lt;br&gt;
[Top posting repaired...please don't do that; it makes following the &lt;br&gt;
conversation much more difficult...]&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;gt; it does increase but it didn't stop at 2. It increases till 3 and&lt;br&gt;
&amp;nbsp;&amp;gt; repeat counter=3 again.&lt;br&gt;
&amp;nbsp;&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;gt; Any idea why?&lt;br&gt;
&lt;br&gt;
As it happens, yes... :)&lt;br&gt;
&lt;br&gt;
What happens in your logic when enter the function w/ handles.count==2?&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Tue, 14 Jul 2009 07:19:01 -0400</pubDate>
      <title>Re: repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#665038</link>
      <author>ching l</author>
      <description>dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;h3g8bd$lin$1@news.eternal-september.org&amp;gt;...&lt;br&gt;
&amp;gt; ching l wrote:&lt;br&gt;
&amp;gt; ....&lt;br&gt;
&amp;gt; &amp;gt; it does increase but it didn't stop at 2. It increases till 3 and&lt;br&gt;
&amp;gt; &amp;gt; repeat counter=3 again.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Any idea why?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; &quot;ching l&quot; &amp;lt;chinglnc@hotmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; &amp;lt;h3g5v9$6ep$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; handles = guidata(gcbo);&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; if(handles.count &amp;lt;= 2)&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;   handles.count= handles.count+1; handles.count&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; else&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;  set(hObject, 'enable', 'off') % switch off button &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; end&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [Top posting repaired...please don't do that; it makes following the &lt;br&gt;
&amp;gt; conversation much more difficult...]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  &amp;gt; it does increase but it didn't stop at 2. It increases till 3 and&lt;br&gt;
&amp;gt;  &amp;gt; repeat counter=3 again.&lt;br&gt;
&amp;gt;  &amp;gt;&lt;br&gt;
&amp;gt;  &amp;gt; Any idea why?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; As it happens, yes... :)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What happens in your logic when enter the function w/ handles.count==2?&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Guess what, the results is the same :-(&lt;br&gt;
&lt;br&gt;
I'm not sure why...</description>
    </item>
    <item>
      <pubDate>Tue, 14 Jul 2009 08:34:20 -0400</pubDate>
      <title>Re: repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#665055</link>
      <author>dpb</author>
      <description>ching l wrote:&lt;br&gt;
&amp;gt; dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;h3g8bd$lin$1@news.eternal-september.org&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; ching l wrote:&lt;br&gt;
&amp;gt;&amp;gt; ....&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; it does increase but it didn't stop at 2. It increases till 3 and&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; repeat counter=3 again.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Any idea why?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; ...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; &quot;ching l&quot; &amp;lt;chinglnc@hotmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;lt;h3g5v9$6ep$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; handles = guidata(gcbo);&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; if(handles.count &amp;lt;= 2)&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   handles.count= handles.count+1; handles.count&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; else&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  set(hObject, 'enable', 'off') % switch off button &lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; end&lt;br&gt;
&amp;gt;&amp;gt; ...&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; [Top posting repaired...please don't do that; it makes following the &lt;br&gt;
&amp;gt;&amp;gt; conversation much more difficult...]&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;  &amp;gt; it does increase but it didn't stop at 2. It increases till 3 and&lt;br&gt;
&amp;gt;&amp;gt;  &amp;gt; repeat counter=3 again.&lt;br&gt;
&amp;gt;&amp;gt;  &amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;  &amp;gt; Any idea why?&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; As it happens, yes... :)&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; What happens in your logic when enter the function w/ handles.count==2?&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Guess what, the results is the same :-(&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I'm not sure why...&lt;br&gt;
&lt;br&gt;
Pretend you're the computer executing the code you provided.  Work thru &lt;br&gt;
line by line w/ what you've told it to do if you start w/ a given value &lt;br&gt;
for count (specifically, 2).&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Tue, 14 Jul 2009 13:10:39 -0400</pubDate>
      <title>Re: repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#665141</link>
      <author>ching l</author>
      <description>dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;h3hgfb$96h$1@news.eternal-september.org&amp;gt;...&lt;br&gt;
&amp;gt; ching l wrote:&lt;br&gt;
&amp;gt; &amp;gt; dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;h3g8bd$lin$1@news.eternal-september.org&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; ching l wrote:&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; ....&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; it does increase but it didn't stop at 2. It increases till 3 and&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; repeat counter=3 again.&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; Any idea why?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; ...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt; &quot;ching l&quot; &amp;lt;chinglnc@hotmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;lt;h3g5v9$6ep$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; handles = guidata(gcbo);&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; if(handles.count &amp;lt;= 2)&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   handles.count= handles.count+1; handles.count&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; else&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  set(hObject, 'enable', 'off') % switch off button &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; ...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; [Top posting repaired...please don't do that; it makes following the &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; conversation much more difficult...]&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;  &amp;gt; it does increase but it didn't stop at 2. It increases till 3 and&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;  &amp;gt; repeat counter=3 again.&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;  &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;  &amp;gt; Any idea why?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; As it happens, yes... :)&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; What happens in your logic when enter the function w/ handles.count==2?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Guess what, the results is the same :-(&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I'm not sure why...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Pretend you're the computer executing the code you provided.  Work thru &lt;br&gt;
&amp;gt; line by line w/ what you've told it to do if you start w/ a given value &lt;br&gt;
&amp;gt; for count (specifically, 2).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; --Thanks.  I understand why it increases to 3 now, but I suppose it should jump to the &quot;else&quot; section when the counter reaches 3 and not repeating the counter again?&lt;br&gt;
&lt;br&gt;
Counter= 3 occurs twice. Which part did I miss again?</description>
    </item>
    <item>
      <pubDate>Tue, 14 Jul 2009 13:26:28 -0400</pubDate>
      <title>Re: repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#665146</link>
      <author>dpb</author>
      <description>ching l wrote:&lt;br&gt;
&amp;gt; dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;h3hgfb$96h$1@news.eternal-september.org&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; ching l wrote:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;h3g8bd$lin$1@news.eternal-september.org&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; ching l wrote:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; ....&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; it does increase but it didn't stop at 2. It increases till 3 and&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; repeat counter=3 again.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Any idea why?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; ...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &quot;ching l&quot; &amp;lt;chinglnc@hotmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;lt;h3g5v9$6ep$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; handles = guidata(gcbo);&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; if(handles.count &amp;lt;= 2)&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;   handles.count= handles.count+1; handles.count&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; else&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;  set(hObject, 'enable', 'off') % switch off button &lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; end&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; ...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; [Top posting repaired...please don't do that; it makes following the &lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; conversation much more difficult...]&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &amp;gt; it does increase but it didn't stop at 2. It increases till 3 and&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &amp;gt; repeat counter=3 again.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;  &amp;gt; Any idea why?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; As it happens, yes... :)&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; What happens in your logic when enter the function w/ handles.count==2?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Guess what, the results is the same :-(&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; I'm not sure why...&lt;br&gt;
&amp;gt;&amp;gt; Pretend you're the computer executing the code you provided.  Work thru &lt;br&gt;
&amp;gt;&amp;gt; line by line w/ what you've told it to do if you start w/ a given value &lt;br&gt;
&amp;gt;&amp;gt; for count (specifically, 2).&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; --Thanks. I understand why it increases to 3 now, but I suppose it&lt;br&gt;
should jump to the &quot;else&quot; section when the counter reaches 3 and not&lt;br&gt;
repeating the counter again?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Counter= 3 occurs twice. Which part did I miss again?&lt;br&gt;
&lt;br&gt;
OK, I didn't look at the output; I thought the question was &quot;why 3&quot;?&lt;br&gt;
&lt;br&gt;
Hmmm....that's not clear to me from the posted code, either.&lt;br&gt;
&lt;br&gt;
Are you sure there isn't something not in this code that took one off it &lt;br&gt;
or another line that outputs it on that condition?&lt;br&gt;
&lt;br&gt;
The code in isolation does appear that the 2nd &quot;3&quot; shouldn't be displayed.&lt;br&gt;
&lt;br&gt;
I gather this is somehow called from a GUI?  I've never written a single &lt;br&gt;
ML GUI interface (and hope to continue that record :) ) -- perhaps &lt;br&gt;
there's something about events that there's another in the queue or &lt;br&gt;
something related to the GUI portion; that's out of my realm...&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Tue, 14 Jul 2009 13:39:18 -0400</pubDate>
      <title>Re: repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#665151</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;dpb&quot; &amp;lt;none@non.net&amp;gt; wrote in message &lt;br&gt;
news:h3i1jj$r9o$1@news.eternal-september.org...&lt;br&gt;
&amp;gt; ching l wrote:&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; --Thanks. I understand why it increases to 3 now, but I suppose it&lt;br&gt;
&amp;gt; should jump to the &quot;else&quot; section when the counter reaches 3 and not&lt;br&gt;
&amp;gt; repeating the counter again?&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Counter= 3 occurs twice. Which part did I miss again?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; OK, I didn't look at the output; I thought the question was &quot;why 3&quot;?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Hmmm....that's not clear to me from the posted code, either.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Are you sure there isn't something not in this code that took one off it &lt;br&gt;
&amp;gt; or another line that outputs it on that condition?&lt;br&gt;
&lt;br&gt;
I also suspect that there's a line of code later on in the function that &lt;br&gt;
displays the counter variable, probably inserted to try to diagnose another &lt;br&gt;
problem (or perhaps to try to diagnose this problem.)&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com </description>
    </item>
    <item>
      <pubDate>Tue, 14 Jul 2009 21:32:01 -0400</pubDate>
      <title>Re: repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#665311</link>
      <author>ching l</author>
      <description>&quot;Steven Lord&quot; &amp;lt;slord@mathworks.com&amp;gt; wrote in message &amp;lt;h3i1oe$q5s$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;dpb&quot; &amp;lt;none@non.net&amp;gt; wrote in message &lt;br&gt;
&amp;gt; news:h3i1jj$r9o$1@news.eternal-september.org...&lt;br&gt;
&amp;gt; &amp;gt; ching l wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; *snip*&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; --Thanks. I understand why it increases to 3 now, but I suppose it&lt;br&gt;
&amp;gt; &amp;gt; should jump to the &quot;else&quot; section when the counter reaches 3 and not&lt;br&gt;
&amp;gt; &amp;gt; repeating the counter again?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Counter= 3 occurs twice. Which part did I miss again?&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; OK, I didn't look at the output; I thought the question was &quot;why 3&quot;?&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Hmmm....that's not clear to me from the posted code, either.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Are you sure there isn't something not in this code that took one off it &lt;br&gt;
&amp;gt; &amp;gt; or another line that outputs it on that condition?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I also suspect that there's a line of code later on in the function that &lt;br&gt;
&amp;gt; displays the counter variable, probably inserted to try to diagnose another &lt;br&gt;
&amp;gt; problem (or perhaps to try to diagnose this problem.)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -- &lt;br&gt;
&amp;gt; Steve Lord&lt;br&gt;
&amp;gt; slord@mathworks.com &lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
OK. The whole thing is like this.&lt;br&gt;
&lt;br&gt;
handles = guidata(gcbo); &lt;br&gt;
&lt;br&gt;
if(handles.count&amp;lt;=2) &lt;br&gt;
&lt;br&gt;
handles.count= handles.count+1;&lt;br&gt;
&lt;br&gt;
handles.count= count&lt;br&gt;
&lt;br&gt;
else &lt;br&gt;
&lt;br&gt;
set(hObject, 'enable', 'off') &lt;br&gt;
&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
guidata(gcbo, handles);&lt;br&gt;
&lt;br&gt;
[audio, fs] = wavread('C:\a.wav');&lt;br&gt;
samples{300} = {audio, fs};&lt;br&gt;
&lt;br&gt;
[audio, fs] = wavread('C:\b.wav');&lt;br&gt;
samples{301} = {audio, fs};&lt;br&gt;
&lt;br&gt;
[audio, fs] = wavread('C:\b.wav');&lt;br&gt;
samples{302} = {audio, fs};&lt;br&gt;
&lt;br&gt;
handles.randValue=299+handles.count;&lt;br&gt;
&lt;br&gt;
play= handles.randvalue&lt;br&gt;
&lt;br&gt;
wavplay(samples{handles.randValue}{:}) ;&lt;br&gt;
&amp;nbsp;&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
&lt;br&gt;
--------------------&lt;br&gt;
The results are&lt;br&gt;
&lt;br&gt;
count= 0     play= 300 ;&lt;br&gt;
count= 1     play= 301 ;&lt;br&gt;
count = 2    play = 302 ;&lt;br&gt;
play= 302 ;  disable button&lt;br&gt;
&lt;br&gt;
----------------------&lt;br&gt;
&lt;br&gt;
what I want is &lt;br&gt;
count= 0     play= 300 ;&lt;br&gt;
count= 1     play= 301 ;&lt;br&gt;
count = 2    play = 302 ;&lt;br&gt;
disable button&lt;br&gt;
&lt;br&gt;
can anyone tell me whether my logic is not right or the codes are not right?</description>
    </item>
    <item>
      <pubDate>Tue, 14 Jul 2009 23:46:59 -0400</pubDate>
      <title>Re: repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#665329</link>
      <author>dpb</author>
      <description>ching l wrote:&lt;br&gt;
...&lt;br&gt;
&amp;gt; handles = guidata(gcbo); &lt;br&gt;
&amp;gt; if(handles.count&amp;lt;=2) &lt;br&gt;
&amp;gt;   handles.count= handles.count+1;&lt;br&gt;
&amp;gt;   handles.count= count&lt;br&gt;
&amp;gt; else &lt;br&gt;
&amp;gt;   set(hObject, 'enable', 'off') &lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; guidata(gcbo, handles);&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; handles.randValue=299+handles.count;&lt;br&gt;
&amp;gt; play= handles.randvalue&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; --------------------&lt;br&gt;
&amp;gt; The results are&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; count= 0     play= 300 ;&lt;br&gt;
&amp;gt; count= 1     play= 301 ;&lt;br&gt;
&amp;gt; count = 2    play = 302 ;&lt;br&gt;
&amp;gt; play= 302 ;  disable button&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ----------------------&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; what I want is &lt;br&gt;
&amp;gt; count= 0     play= 300 ;&lt;br&gt;
&amp;gt; count= 1     play= 301 ;&lt;br&gt;
&amp;gt; count = 2    play = 302 ;&lt;br&gt;
&amp;gt; disable button&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; can anyone tell me whether my logic is not right or the codes are not right?&lt;br&gt;
&lt;br&gt;
Not from this, no--there's no way the output you've listed could have &lt;br&gt;
been generated from this code -- one needs _PRECISELY_AND_IDENTICALLY_, &lt;br&gt;
_WITHOUT_ANY_EDITING_ for presentation the code that generated the &lt;br&gt;
output, also not edited...&lt;br&gt;
&lt;br&gt;
For example, the output says &quot;count&quot; but the line w/o a semicolon is&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;gt; handles.count= count&lt;br&gt;
&lt;br&gt;
which would display &quot;handles.count = 0&quot; assuming count is 0 on entry.&lt;br&gt;
&lt;br&gt;
Perhaps, in fact, therein is part of the problem--you increment&lt;br&gt;
handles.count and then set it to count which will in essence undoes the &lt;br&gt;
increment operation.&lt;br&gt;
&lt;br&gt;
I suspect your problems are tied in with this problem...&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Wed, 15 Jul 2009 07:34:02 -0400</pubDate>
      <title>Re: repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#665362</link>
      <author>ching l</author>
      <description>dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;h3j5kc$9je$1@news.eternal-september.org&amp;gt;...&lt;br&gt;
&amp;gt; ching l wrote:&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; &amp;gt; handles = guidata(gcbo); &lt;br&gt;
&amp;gt; &amp;gt; if(handles.count&amp;lt;=2) &lt;br&gt;
&amp;gt; &amp;gt;   handles.count= handles.count+1;&lt;br&gt;
&amp;gt; &amp;gt; handles.count =    count&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; &amp;gt; else &lt;br&gt;
&amp;gt; &amp;gt;   set(hObject, 'enable', 'off') &lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; guidata(gcbo, handles);&lt;br&gt;
&amp;gt; &amp;gt; ...&lt;br&gt;
&amp;gt; &amp;gt; handles.randValue=299+handles.count;&lt;br&gt;
&amp;gt; &amp;gt; play= handles.randvalue&lt;br&gt;
&amp;gt; &amp;gt; ...&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; --------------------&lt;br&gt;
&amp;gt; &amp;gt; The results are&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; count= 0     play= 300 ;&lt;br&gt;
&amp;gt; &amp;gt; count= 1     play= 301 ;&lt;br&gt;
&amp;gt; &amp;gt; count = 2    play = 302 ;&lt;br&gt;
&amp;gt; &amp;gt; play= 302 ;  disable button&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; ----------------------&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; what I want is &lt;br&gt;
&amp;gt; &amp;gt; count= 0     play= 300 ;&lt;br&gt;
&amp;gt; &amp;gt; count= 1     play= 301 ;&lt;br&gt;
&amp;gt; &amp;gt; count = 2    play = 302 ;&lt;br&gt;
&amp;gt; &amp;gt; disable button&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; can anyone tell me whether my logic is not right or the codes are not right?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Not from this, no--there's no way the output you've listed could have &lt;br&gt;
&amp;gt; been generated from this code -- one needs _PRECISELY_AND_IDENTICALLY_, &lt;br&gt;
&amp;gt; _WITHOUT_ANY_EDITING_ for presentation the code that generated the &lt;br&gt;
&amp;gt; output, also not edited...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; For example, the output says &quot;count&quot; but the line w/o a semicolon is&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  &amp;gt; handles.count= count&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; which would display &quot;handles.count = 0&quot; assuming count is 0 on entry.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Perhaps, in fact, therein is part of the problem--you increment&lt;br&gt;
&amp;gt; handles.count and then set it to count which will in essence undoes the &lt;br&gt;
&amp;gt; increment operation.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I suspect your problems are tied in with this problem...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; --I'm sorry,  i've accidentally edited that line when I try to make the codes look more reasonable..&lt;br&gt;
&lt;br&gt;
it should be count= handles.count and that's the value that display on the matlab command window. I'm not sure what you mean by &quot;you increment&lt;br&gt;
handles.count and then set it to count which will in essence undoes the &lt;br&gt;
increment operation.&quot; Would you mind to explain a little bit?&lt;br&gt;
&lt;br&gt;
Anyway the codes should look like this-&lt;br&gt;
&lt;br&gt;
handles = guidata(gcbo);&lt;br&gt;
&lt;br&gt;
if(handles.count&amp;lt;=2)&lt;br&gt;
&lt;br&gt;
handles.count= handles.count+1;&lt;br&gt;
&lt;br&gt;
count = handles.count&lt;br&gt;
&lt;br&gt;
else&lt;br&gt;
&lt;br&gt;
set(hObject, 'enable', 'off')&lt;br&gt;
&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
guidata(gcbo, handles);&lt;br&gt;
&lt;br&gt;
[audio, fs] = wavread('C:\a.wav');&lt;br&gt;
samples{300} = {audio, fs};&lt;br&gt;
&lt;br&gt;
[audio, fs] = wavread('C:\b.wav');&lt;br&gt;
samples{301} = {audio, fs};&lt;br&gt;
&lt;br&gt;
[audio, fs] = wavread('C:\b.wav');&lt;br&gt;
samples{302} = {audio, fs};&lt;br&gt;
&lt;br&gt;
handles.randValue=299+handles.count;&lt;br&gt;
&lt;br&gt;
play= handles.randvalue&lt;br&gt;
&lt;br&gt;
wavplay(samples{handles.randValue}{:}) ;&lt;br&gt;
&amp;nbsp;&lt;br&gt;
guidata(hObject, handles);&lt;br&gt;
&lt;br&gt;
--------------------&lt;br&gt;
The results are&lt;br&gt;
&lt;br&gt;
count= 0 play= 300 ;&lt;br&gt;
count= 1 play= 301 ;&lt;br&gt;
count = 2 play = 302 ;&lt;br&gt;
play= 302 ; disable button&lt;br&gt;
&lt;br&gt;
----------------------&lt;br&gt;
&lt;br&gt;
what I want is&lt;br&gt;
count= 0 play= 300 ;&lt;br&gt;
count= 1 play= 301 ;&lt;br&gt;
count = 2 play = 302 ;&lt;br&gt;
disable button</description>
    </item>
    <item>
      <pubDate>Wed, 15 Jul 2009 14:18:17 -0400</pubDate>
      <title>Re: repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#665481</link>
      <author>dpb</author>
      <description>ching l wrote:&lt;br&gt;
...&lt;br&gt;
&amp;gt; ...I'm not sure what you mean by &quot;you increment&lt;br&gt;
&amp;gt; handles.count and then set it to count which will in essence undoes the &lt;br&gt;
&amp;gt; increment operation.&quot; Would you mind to explain a little bit?&lt;br&gt;
&lt;br&gt;
That's what the _POSTED_ code did which was NOT the actual code run. &lt;br&gt;
It's absolutely impossible to debug when provided incorrect &lt;br&gt;
information... :(&lt;br&gt;
&lt;br&gt;
&amp;gt; Anyway the codes should look like this-&lt;br&gt;
&lt;br&gt;
I've pared it down to the portion that has to do w/ the counter and &lt;br&gt;
debugging i/o below...&lt;br&gt;
&lt;br&gt;
Note the indenting to emphasize the logical structure; I strongly &lt;br&gt;
recommend you adopt some sort of similar (but consistent) formatting; &lt;br&gt;
you will find it will help immeasurably in reading your code.&lt;br&gt;
&lt;br&gt;
&amp;gt; handles = guidata(gcbo);&lt;br&gt;
&amp;gt; if(handles.count&amp;lt;=2)&lt;br&gt;
&amp;gt;   handles.count= handles.count+1;&lt;br&gt;
&amp;gt;   count = handles.count&lt;br&gt;
&amp;gt; else&lt;br&gt;
&amp;gt;   set(hObject, 'enable', 'off')&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; guidata(gcbo, handles);&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; handles.randValue=299+handles.count;&lt;br&gt;
&amp;gt; play= handles.randvalue&lt;br&gt;
...&lt;br&gt;
&amp;gt; guidata(hObject, handles);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; --------------------&lt;br&gt;
&amp;gt; The results are&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; count= 0 play= 300 ;&lt;br&gt;
&amp;gt; count= 1 play= 301 ;&lt;br&gt;
&amp;gt; count = 2 play = 302 ;&lt;br&gt;
&amp;gt; play= 302 ; disable button&lt;br&gt;
&lt;br&gt;
OK, I see everything except what generated the &quot;disable button&quot; message? &lt;br&gt;
&amp;nbsp;&amp;nbsp;There's nothing in the code above I see that would have done it.&lt;br&gt;
&lt;br&gt;
It's clear why everything else is as it is; the counter is &lt;br&gt;
incremented/displayed for 0,1,2 as is &quot;play&quot;.  The line&lt;br&gt;
&lt;br&gt;
play= handles.randvalue&lt;br&gt;
&lt;br&gt;
is outside the if...else...end construct so it is executed every time &lt;br&gt;
the function is called w/ the last value of the counter.&lt;br&gt;
&lt;br&gt;
As noted, I can only assume you again added the &quot;disable&quot; button&quot; to the &lt;br&gt;
posting...&lt;br&gt;
&lt;br&gt;
&amp;gt; ----------------------&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; what I want is&lt;br&gt;
&amp;gt; count= 0 play= 300 ;&lt;br&gt;
&amp;gt; count= 1 play= 301 ;&lt;br&gt;
&amp;gt; count = 2 play = 302 ;&lt;br&gt;
&amp;gt; disable button&lt;br&gt;
&lt;br&gt;
See above as to why the other &quot;play =&quot; message appeared.&lt;br&gt;
&lt;br&gt;
You'll have to decide what the code is supposed to do once the counter &lt;br&gt;
has been incremented.&lt;br&gt;
&lt;br&gt;
If the real question is there's an additional event generated after you &lt;br&gt;
think you have disabled the control, I don't know a thing about how ML &lt;br&gt;
GUIs work at the control level; as noted I don't use anything except the &lt;br&gt;
command window interface in ML.&lt;br&gt;
&lt;br&gt;
If I were debugging I'd do something like&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;gt; handles = guidata(gcbo);&lt;br&gt;
&amp;nbsp;&amp;gt; if(handles.count&amp;lt;=2)&lt;br&gt;
&amp;nbsp;&amp;gt;   handles.count= handles.count+1;&lt;br&gt;
&amp;nbsp;&amp;gt;   count = handles.count&lt;br&gt;
&amp;nbsp;&amp;gt; else&lt;br&gt;
&amp;nbsp;&amp;gt;   set(hObject, 'enable', 'off')&lt;br&gt;
&amp;nbsp;&amp;gt;   disp(['Disabled control'])&lt;br&gt;
&amp;nbsp;&amp;gt; end&lt;br&gt;
&amp;nbsp;&amp;gt; guidata(gcbo, handles);&lt;br&gt;
&amp;nbsp;&amp;gt; ...&lt;br&gt;
&amp;nbsp;&amp;gt; handles.randValue=299+handles.count;&lt;br&gt;
&amp;nbsp;&amp;gt; play= handles.randvalue&lt;br&gt;
&lt;br&gt;
to get the sequencing documented.&lt;br&gt;
&lt;br&gt;
Also, when you post the results of any more testing, simply paste the &lt;br&gt;
contents of the command window; don't rearrange lines, etc., other than &lt;br&gt;
perhaps to squeeze out blank lines.  It confuses the issue when the &lt;br&gt;
code/output obviously don't match; sometimes it's just cosmetic, other &lt;br&gt;
times as the previous post it changes the meaning entirely and makes the &lt;br&gt;
whole post worse than meaningless.  The point to be learned is you must &lt;br&gt;
be precise to have any chance at all of getting meaningful response.  A &lt;br&gt;
secondary lesson is if you continue to create confusion by not adhering &lt;br&gt;
to the above, folks will soon tire of going thru the exercise of &lt;br&gt;
futility and just ignore the thread...&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Wed, 15 Jul 2009 19:31:04 -0400</pubDate>
      <title>Re: repetitive counter (GUI)</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/256034#665582</link>
      <author>dpb</author>
      <description>dpb wrote:&lt;br&gt;
...&lt;br&gt;
&amp;gt; If the real question is there's an additional event generated after you &lt;br&gt;
&amp;gt; think you have disabled the control, ...&lt;br&gt;
&lt;br&gt;
OK, it's obvious; I overlooked it myself though. :(&lt;br&gt;
&lt;br&gt;
Walk thru the code line-by-line again for count == 1, 2, ... and trace &lt;br&gt;
on a line of paper _when_ you actually disable the control.&lt;br&gt;
&lt;br&gt;
All should become apparent at that point; there's nothing at all to do &lt;br&gt;
w/ there being anything going on about the ML GUI controls at all (not &lt;br&gt;
that I really thought so; only that, as I say, I was looking at the code &lt;br&gt;
from the wrong standpoint before only concentrating on the &quot;why&quot; of the &lt;br&gt;
outputs until I realized the underlying question)...&lt;br&gt;
&lt;br&gt;
I'll leave it as an &quot;exercise for the student&quot; to come up w/ a fix at &lt;br&gt;
least initially.... :)&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
  </channel>
</rss>

