Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Standalone real windows program by MATLAB

Subject: Standalone real windows program by MATLAB

From: Bindubritta Acharjee

Date: 3 May, 2009 05:09:01

Message: 1 of 7

Hi,

I’ve developed a reminder application, which sounds and shows a dialog box with ‘OK’ and ‘Snooze’. Anyway, in MATLAB its performance is satisfactory. But I want to make it as a standalone windows program which will do the same (generate sound & show dialog box). For this, I’ve used MATLAB Builder EX’s Development Tool. But it has generated a dos program, some text files (including C code). This is not working at all.

Please help to build a real standalone windows program, which will generate sound and show dialog box as it does in MATLAB.


Best regards,

bindubritta

Subject: Standalone real windows program by MATLAB

From: Bindubritta Acharjee

Date: 4 May, 2009 03:26:01

Message: 2 of 7

Yesterday I installed Microsoft Visual Studio 2008 and then run 'mbuild -setup' again in MATLAB. MATLAB sourced the Microsoft Visual C++ 2008 and I set it as default compiler. Using 'Standalone Application' I compile the magicexample.m file and got the DOS exe file as previous. Using 'Windows Standalone Application' I got also an .exe file though, but it worked nothing, it did not show any response even.

Please help me to solve this.

Subject: Standalone real windows program by MATLAB

From: Jiro Doke

Date: 4 May, 2009 12:40:19

Message: 3 of 7

"Bindubritta Acharjee" <bindubritta@hotmail.com> wrote in message <gtln89$5d6$1@fred.mathworks.com>...
> Yesterday I installed Microsoft Visual Studio 2008 and then run 'mbuild -setup' again in MATLAB. MATLAB sourced the Microsoft Visual C++ 2008 and I set it as default compiler. Using 'Standalone Application' I compile the magicexample.m file and got the DOS exe file as previous. Using 'Windows Standalone Application' I got also an .exe file though, but it worked nothing, it did not show any response even.
>
> Please help me to solve this.

Have you tried building "Windows Standalone Application" for your reminder application? The behavior you saw for "magicexample" is expected. It's a function that takes input and just returns an output, so it opened and closed as soon as it finished. An application with a GUI will remain open.

You should design your app so that when you run it, you can run without any input argument. If you require input arguments, incorporate within your GUI application, use a file, or specify it in the application property in Windows.

Subject: Standalone real windows program by MATLAB

From: Bindubritta Acharjee

Date: 5 May, 2009 04:28:01

Message: 4 of 7

Dear Doke,

Thank you very much for your reply. Al last someone replied. I thought – no one will response about it.

Anyway, I made magic_test.m file as –

a=magicsquare(5);
pause(10);

The dos .exe file executed, showed the magic square and closed after 10 seconds automatically. But the .exe file by ‘Window Standalone Application’ showed no response.

Please tell, is it possible at all to get ‘Windows Standalone Application’ by MATLAB complier (using Microsoft Visual C++ 8.0 as default compiler) without any modification in respective .m file? If it gives, required real windows output (sound, message/dialogue box) in MATLAB then why it need further modification? MATLAB will modify the .m code as needed. If I have to change, then I think – it will be better to learn Visual C++/Basic etc. rather than MATLAB.

Best regards,
Bindubritta

Subject: Standalone real windows program by MATLAB

From: Ali

Date: 5 May, 2009 08:52:01

Message: 5 of 7

"Bindubritta Acharjee" <bindubritta@hotmail.com> wrote in message <gtj8td$pp0$1@fred.mathworks.com>...
> Hi,
>
> I’ve developed a reminder application, which sounds and shows a dialog box with ‘OK’ and ‘Snooze’. Anyway, in MATLAB its performance is satisfactory. But I want to make it as a standalone windows program which will do the same (generate sound & show dialog box). For this, I’ve used MATLAB Builder EX’s Development Tool. But it has generated a dos program, some text files (including C code). This is not working at all.
>
> Please help to build a real standalone windows program, which will generate sound and show dialog box as it does in MATLAB.
>
>
> Best regards,
>
> bindubritta

Subject: Standalone real windows program by MATLAB

From: Amit Jain

Date: 5 May, 2009 14:57:01

Message: 6 of 7

"Bindubritta Acharjee" <bindubritta@hotmail.com> wrote in message <gtof8h$bnk$1@fred.mathworks.com>...
> Dear Doke,
>
> Thank you very much for your reply. Al last someone replied. I thought – no one will response about it.
>
> Anyway, I made magic_test.m file as –
>
> a=magicsquare(5);
> pause(10);
>
> The dos .exe file executed, showed the magic square and closed after 10 seconds automatically. But the .exe file by ‘Window Standalone Application’ showed no response.
>
> Please tell, is it possible at all to get ‘Windows Standalone Application’ by MATLAB complier (using Microsoft Visual C++ 8.0 as default compiler) without any modification in respective .m file? If it gives, required real windows output (sound, message/dialogue box) in MATLAB then why it need further modification? MATLAB will modify the .m code as needed. If I have to change, then I think – it will be better to learn Visual C++/Basic etc. rather than MATLAB.
>
> Best regards,
> Bindubritta

With Windows Standalone Application, you will not see any outputs that go to standard out (on windows it is equivalent to the DOS window). Use GUI components like msgbox instead to show output to users.

For example:

magic_test.m
a=magicsquare(5);
msgbox(num2str(a))


Compiling and running the above code as a Windows Standalone application will show a message box with the magic square. This message box will stay up until you hit the OK button. Note that you did not have to use PAUSE.

Subject: Standalone real windows program by MATLAB

From: Bindubritta Acharjee

Date: 6 May, 2009 05:40:03

Message: 7 of 7

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.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us