|
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.
|