<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173201</link>
    <title>MATLAB Central Newsreader - call &quot;callback function&quot; again</title>
    <description>Feed for thread: call &quot;callback function&quot; again</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>Thu, 24 Jul 2008 17:26:01 -0400</pubDate>
      <title>call &quot;callback function&quot; again</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173201#445239</link>
      <author>ching l</author>
      <description>function pushbutton9_Callback(hObject, eventdata, handles)&lt;br&gt;
&lt;br&gt;
if handles.randValue &amp;lt;=5&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
;&lt;br&gt;
&lt;br&gt;
else&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
wavplay(ssamples{handles.randValue}{:}) ;&lt;br&gt;
&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Instead of &quot;doing nothing&quot; when the handles.randValue &amp;lt;=5, &lt;br&gt;
how do I call the &quot;callback function&quot; again? I want it&lt;br&gt;
persistently call the &quot;callback function&quot; &lt;br&gt;
&lt;br&gt;
if handles.randValue &amp;lt;=5&lt;br&gt;
&lt;br&gt;
&amp;nbsp;set(hObject, 'Callback', '');&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
this is what I tried, but not right...</description>
    </item>
    <item>
      <pubDate>Thu, 24 Jul 2008 17:38:51 -0400</pubDate>
      <title>Re: call &quot;callback function&quot; again</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173201#445245</link>
      <author>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)</author>
      <description>In article &amp;lt;g6adv9$4do$1@fred.mathworks.com&amp;gt;,&lt;br&gt;
ching l &amp;lt;chinglnc@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;function pushbutton9_Callback(hObject, eventdata, handles)&lt;br&gt;
&lt;br&gt;
&amp;gt;if handles.randValue &amp;lt;=5&lt;br&gt;
&amp;gt;;&lt;br&gt;
&amp;gt;else&lt;br&gt;
&amp;gt;wavplay(ssamples{handles.randValue}{:}) ;&lt;br&gt;
&amp;gt;end&lt;br&gt;
&lt;br&gt;
&amp;gt;Instead of &quot;doing nothing&quot; when the handles.randValue &amp;lt;=5, &lt;br&gt;
&amp;gt;how do I call the &quot;callback function&quot; again? I want it&lt;br&gt;
&amp;gt;persistently call the &quot;callback function&quot; &lt;br&gt;
&lt;br&gt;
&amp;gt;if handles.randValue &amp;lt;=5&lt;br&gt;
&amp;gt; set(hObject, 'Callback', '');&lt;br&gt;
&amp;gt;this is what I tried, but not right...&lt;br&gt;
&lt;br&gt;
function pushbutton9_Callback(hObject, eventdata, handles)&lt;br&gt;
&amp;nbsp;&amp;nbsp;if handles.randValue &amp;lt;= 5&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cb = get(hObject, 'Callback');&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cb{1}(hObject, eventdata, handles);&lt;br&gt;
&amp;nbsp;&amp;nbsp;else&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wavplay(ssamples{handles.randValue}{:});&lt;br&gt;
&amp;nbsp;&amp;nbsp;end&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
This code does what you asked; unfortunately what you asked for&lt;br&gt;
is highly unlikely to be useful for anything other than crashing&lt;br&gt;
your program with a complaint about the recursion limit being&lt;br&gt;
exceeded.&lt;br&gt;
&lt;br&gt;
Wouldn't it be wiser to at least change the value of handles.randValue&lt;br&gt;
before calling the same routine again?&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
&amp;nbsp;&amp;nbsp;&quot;Is there any thing whereof it may be said, See, this is new? It hath&lt;br&gt;
&amp;nbsp;&amp;nbsp;been already of old time, which was before us.&quot;    -- Ecclesiastes</description>
    </item>
    <item>
      <pubDate>Thu, 24 Jul 2008 18:09:01 -0400</pubDate>
      <title>Re: call</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173201#445263</link>
      <author>ching l</author>
      <description>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in&lt;br&gt;
message &amp;lt;g6aenb$ki4$1@canopus.cc.umanitoba.ca&amp;gt;...&lt;br&gt;
&amp;gt; In article &amp;lt;g6adv9$4do$1@fred.mathworks.com&amp;gt;,&lt;br&gt;
&amp;gt; ching l &amp;lt;chinglnc@hotmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt;function pushbutton9_Callback(hObject, eventdata, handles)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;if handles.randValue &amp;lt;=5&lt;br&gt;
&amp;gt; &amp;gt;;&lt;br&gt;
&amp;gt; &amp;gt;else&lt;br&gt;
&amp;gt; &amp;gt;wavplay(ssamples{handles.randValue}{:}) ;&lt;br&gt;
&amp;gt; &amp;gt;end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;Instead of &quot;doing nothing&quot; when the handles.randValue &amp;lt;=5, &lt;br&gt;
&amp;gt; &amp;gt;how do I call the &quot;callback function&quot; again? I want it&lt;br&gt;
&amp;gt; &amp;gt;persistently call the &quot;callback function&quot; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;if handles.randValue &amp;lt;=5&lt;br&gt;
&amp;gt; &amp;gt; set(hObject, 'Callback', '');&lt;br&gt;
&amp;gt; &amp;gt;this is what I tried, but not right...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; function pushbutton9_Callback(hObject, eventdata, handles)&lt;br&gt;
&amp;gt;   if handles.randValue &amp;lt;= 5&lt;br&gt;
&amp;gt;     cb = get(hObject, 'Callback');&lt;br&gt;
&amp;gt;     cb{1}(hObject, eventdata, handles);&lt;br&gt;
&amp;gt;   else&lt;br&gt;
&amp;gt;     wavplay(ssamples{handles.randValue}{:});&lt;br&gt;
&amp;gt;   end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This code does what you asked; unfortunately what you&lt;br&gt;
asked for&lt;br&gt;
&amp;gt; is highly unlikely to be useful for anything other than&lt;br&gt;
crashing&lt;br&gt;
&amp;gt; your program with a complaint about the recursion limit being&lt;br&gt;
&amp;gt; exceeded.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Wouldn't it be wiser to at least change the value of&lt;br&gt;
handles.randValue&lt;br&gt;
&amp;gt; before calling the same routine again?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -- &lt;br&gt;
&amp;gt;   &quot;Is there any thing whereof it may be said, See, this is&lt;br&gt;
new? It hath&lt;br&gt;
&amp;gt;   been already of old time, which was before us.&quot;    --&lt;br&gt;
Ecclesiastes&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Sorry if the question is confusing, &lt;br&gt;
&lt;br&gt;
I have two group of similar callback function:&lt;br&gt;
&lt;br&gt;
function group1_CreateFcn(hObject, eventdata, handles)&lt;br&gt;
&lt;br&gt;
[audio, fs] = wavread('F:\matlab_gui\speech');&lt;br&gt;
ssamples{1} = {audio, fs};&lt;br&gt;
[audio, fs] = wavread('F:\matlab_gui\gtr');&lt;br&gt;
ssamples{2} = {audio, fs};&lt;br&gt;
&lt;br&gt;
%all the way up to {99}&lt;br&gt;
%*******&lt;br&gt;
&lt;br&gt;
function group2_CreateFcn(hObject, eventdata, handles)&lt;br&gt;
&lt;br&gt;
[audio, fs] = wavread('F:\matlab_gui\speech');&lt;br&gt;
ssamples{100} = {audio, fs};&lt;br&gt;
[audio, fs] = wavread('F:\matlab_gui\gtr');&lt;br&gt;
ssamples{101} = {audio, fs};&lt;br&gt;
&lt;br&gt;
%*******&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
so when I do this for both;&lt;br&gt;
&lt;br&gt;
handles.randValue = ceil(length(ssamples)*rand);&lt;br&gt;
&lt;br&gt;
the Group 2 essentially generate the rand value for Group 1&lt;br&gt;
also, which is something that I don't want.&lt;br&gt;
&lt;br&gt;
So, I want to limit group 2 so that the handles.value only&lt;br&gt;
start from {100} onwards.&lt;br&gt;
&lt;br&gt;
The only way that I can thought of is to call the&lt;br&gt;
CallFunction of Group 2 when handles.value is larger than {99}.&lt;br&gt;
&lt;br&gt;
Or is there any better way to do it? The reason that I break&lt;br&gt;
into two groups is that the push button has great latency &lt;br&gt;
for Group 1 (which was originally more than 150 files).&lt;br&gt;
&lt;br&gt;
please advice.&lt;br&gt;
&amp;nbsp;&amp;nbsp;</description>
    </item>
  </channel>
</rss>

