Path: news.mathworks.com!not-for-mail
From: "ching l" <chinglnc@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: call
Date: Thu, 24 Jul 2008 18:09:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 93
Message-ID: <g6agft$7cb$1@fred.mathworks.com>
References: <g6adv9$4do$1@fred.mathworks.com> <g6aenb$ki4$1@canopus.cc.umanitoba.ca>
Reply-To: "ching l" <chinglnc@hotmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1216922941 7563 172.30.248.37 (24 Jul 2008 18:09:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 24 Jul 2008 18:09:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1438759
Xref: news.mathworks.com comp.soft-sys.matlab:481617



roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <g6aenb$ki4$1@canopus.cc.umanitoba.ca>...
> In article <g6adv9$4do$1@fred.mathworks.com>,
> ching l <chinglnc@hotmail.com> wrote:
> >function pushbutton9_Callback(hObject, eventdata, handles)
> 
> >if handles.randValue <=5
> >;
> >else
> >wavplay(ssamples{handles.randValue}{:}) ;
> >end
> 
> >Instead of "doing nothing" when the handles.randValue <=5, 
> >how do I call the "callback function" again? I want it
> >persistently call the "callback function" 
> 
> >if handles.randValue <=5
> > set(hObject, 'Callback', '');
> >this is what I tried, but not right...
> 
> function pushbutton9_Callback(hObject, eventdata, handles)
>   if handles.randValue <= 5
>     cb = get(hObject, 'Callback');
>     cb{1}(hObject, eventdata, handles);
>   else
>     wavplay(ssamples{handles.randValue}{:});
>   end
> 
> 
> This code does what you asked; unfortunately what you
asked for
> is highly unlikely to be useful for anything other than
crashing
> your program with a complaint about the recursion limit being
> exceeded.
> 
> Wouldn't it be wiser to at least change the value of
handles.randValue
> before calling the same routine again?
> 
> -- 
>   "Is there any thing whereof it may be said, See, this is
new? It hath
>   been already of old time, which was before us."    --
Ecclesiastes


Sorry if the question is confusing, 

I have two group of similar callback function:

function group1_CreateFcn(hObject, eventdata, handles)

[audio, fs] = wavread('F:\matlab_gui\speech');
ssamples{1} = {audio, fs};
[audio, fs] = wavread('F:\matlab_gui\gtr');
ssamples{2} = {audio, fs};

%all the way up to {99}
%*******

function group2_CreateFcn(hObject, eventdata, handles)

[audio, fs] = wavread('F:\matlab_gui\speech');
ssamples{100} = {audio, fs};
[audio, fs] = wavread('F:\matlab_gui\gtr');
ssamples{101} = {audio, fs};

%*******


so when I do this for both;

handles.randValue = ceil(length(ssamples)*rand);

the Group 2 essentially generate the rand value for Group 1
also, which is something that I don't want.

So, I want to limit group 2 so that the handles.value only
start from {100} onwards.

The only way that I can thought of is to call the
CallFunction of Group 2 when handles.value is larger than {99}.

Or is there any better way to do it? The reason that I break
into two groups is that the push button has great latency 
for Group 1 (which was originally more than 150 files).

please advice.