Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Standalone real windows program by MATLAB
Date: Wed, 6 May 2009 05:40:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 103
Message-ID: <gtr7rj$crv$1@fred.mathworks.com>
References: <gtj8td$pp0$1@fred.mathworks.com> <gtln89$5d6$1@fred.mathworks.com> <gtmnnj$n5s$1@fred.mathworks.com> <gtof8h$bnk$1@fred.mathworks.com> <gtpk3t$ifr$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1241588403 13183 172.30.248.38 (6 May 2009 05:40:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 6 May 2009 05:40:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1826061
Xref: news.mathworks.com comp.soft-sys.matlab:537781


Thank you Amit! Your suggestion is accurate and it works right.

However, my program is not working. I found no response, but it works in MATLAB. It gives reminder (shows message box) with sound in MATLAB. But whenever I compiled it for standalone it does not work. 

Here is the codes.

refMin=[8 10 12 14 16];
msg=[1 1 0 1 1];

c=clock;

if((c(5)>7)&&(c(5)<18))
   d-c(5);
      
   if(d=)
       incd=1;
   elseif((d<=9)&&(d>7))
       incd=2;
   elseif((d<=7)&&(d>5))
       incd=3;
   elseif((d<=5)&&(d>3))
       incd=4;
   elseif((d<=3)&&(d>1))
       incd=5;
   else
       incd=0;
   end
   
   sfs`-c(6);
   sfm=(refMin(incd)-c(5))*60;
   ts=sfs+sfm;
   
   for i=incd:5
       remindit_test(ts,msg(i));
       ts=ts+120;
   end
   
else
    exit;   
end

---------------------------------------------------------------
Here is the codes for remindit_test(ts,msg(i))
---------------------------------------------------------------

function [] = remindit_test(ts,msg)

tmr = timer('Period',1,...  % 1 sec snooze time.                
      'StartDelay',ts,... % alarm time in seconds.
      'TasksToExecute',5,...  % number of snoozes allowed.
      'ExecutionMode','fixedSpacing',...
      'TimerFcn',{@reminder,msg},...   % Function def. below.
      'StopFcn',@deleter);   % Function def. below.  

start(tmr);

function reminder(obj,edata,msg) %#ok  M-Lint doesn't know callback fmt.
% Callback for timerfcn.

load gong
sound(y);

if(msg==1)
    if get(obj, 'TasksExecuted') == 5  % Completed five snoozes
        btn = questdlg({datestr(now,'mmmm dd, yyyy HH:MM:SS AM')},...   % question
            sprintf('DW'),...  % title
            'OK',...   % button1
            'OK');   % default    
    else
        btn = questdlg({datestr(now,'mmmm dd, yyyy HH:MM:SS AM')},...   % question
            sprintf('DW'),... % title
            'OK',...   % button1                                                         
            sprintf('Snooze'),...  % button2                 
            'OK');   % default                                                      
    end
else
    if get(obj, 'TasksExecuted') == 5  % Completed five snoozes    
        btn = questdlg({datestr(now,'mmmm dd, yyyy HH:MM:SS AM')},...   % question
            sprintf('TL'),...  % title
            'OK',...   % button1
            'OK');   % default    
    else
        btn = questdlg({datestr(now,'mmmm dd, yyyy HH:MM:SS AM')},...   % question
            sprintf('TL'),... % title
            'OK',...   % button1                                                         
            sprintf('Snooze'),...  % button2                 
            'OK');   % default                                                      
    end
end
    
clear playsnd;

if isequal(btn,'OK')
   set(obj, 'TasksToExecute', get(obj, 'TasksExecuted')); 
end

function deleter(obj,edata)   %#ok   M-Lint doesn't know the callback fmt.
% Callback for stopfcn.
wait(obj);
delete(obj);


Please help me.