Path: news.mathworks.com!newsfeed-00.mathworks.com!NNTP.WPI.EDU!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: call "callback function" again
Date: Thu, 24 Jul 2008 17:38:51 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 38
Message-ID: <g6aenb$ki4$1@canopus.cc.umanitoba.ca>
References: <g6adv9$4do$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1216921131 21060 192.70.172.160 (24 Jul 2008 17:38:51 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Thu, 24 Jul 2008 17:38:51 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:481599



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