Multiple windows opened when executing a matlab standalone program

12 views (last 30 days)
I am trying to create a standalone program on Win7 that just open a figure and plot a simple function. For example, my program just execute the following two lines: figure(1); plot(1:10,sin(1:10));
I used Matlab Compiler to compile a standalone program (.exe) that works well. The problem is that before creating the figure, several windows are opened (Command Window, Command History, Help, Workspace, Current Folder and Editor).
Is there a way to avoid the opening of these windows?
Thanks in advance.
  3 Comments
Simon Munier
Simon Munier on 10 Feb 2012
Either with the mcc command or with deploytool. Both give same results.
amit pathania
amit pathania on 18 Apr 2012
How to create standalone applications in MATLAB 2012?I am not getting errors while running MATLAB compiler.If someone can help me with steps starting from which all compilers MATLAB 2012a supports?

Sign in to comment.

Answers (2)

Simon Munier
Simon Munier on 9 Feb 2012
After having tryed different configurations, it seems that when launching my standalone program, Windows uses Matlab instead of MCR.
Does anyone know how to force Windows to use MCR ?
  2 Comments
Simon Munier
Simon Munier on 10 Feb 2012
When I compile the matlab function, multiple matlab windows open as when I run the executable compiled program. In both cases, it seems that a new matlab session opens.
I compiled my function on another pc and these windows do not open. The only difference between the two pc is that one is in 32 bits while the other (the one where windows open) is in 64 bits. Could it be the origin of the problem?
Simon Munier
Simon Munier on 10 Feb 2012
Here is a snapshot of what happens when I compile my function.
https://docs.google.com/open?id=0BxuqGNu2WMOfZmZmN2ZjOTItZGQ3ZC00NjJiLTk4NjEtMmUyZTRmMjU3ODA4
Matlab is running in the background window. The new opened windows are in the red box.
There is one more thing that I do not understand, that is the text in the command window:
FEATURE "MATLAB" could not be read.

Sign in to comment.


Eero Kuusi
Eero Kuusi on 10 Feb 2012
I have had the same problem for ages. I made a workaround as follows:
global STARTUP_COMPLETE if STARTUP_COMPLETE return end script STARTUP_COMPLETE = 1;
This effectively removed the duplicate window from opening. However I'm making alterations in my program (putting in copy protection algorithms to be exact) and I must somehow prevent the dual launching from happening. Any advice would be greatly appreciated, I haven't been able to solve this problem.
I'm running r2009a (same thing happens for all earlier versions as well).
br, Eero
  2 Comments
Simon Munier
Simon Munier on 10 Feb 2012
I do not understand the modifications you made. Could you be more clear in the code you added, please?
Namely, where did you add it? At the beggining of the program to be compiled? What is 'script'?
Thanks
Eero Kuusi
Eero Kuusi on 13 Feb 2012
Script is a .m file that doesn't have any functions inside. But it shouldn't make a difference if the main .m file a script or a function, both seem to work fine.
Here's a mock version of a standalone program that uses my modification:
global STARTUP_COMPLETE
if STARTUP_COMPLETE
return
end
disp('Hello World!')
STARTUP_COMPLETE = 1;
This should prevent 'Hello World!' from being displayed twice when you run the program. Naturally, it should prevent anything after the if clause to be run twice. It worked fine for me until I made some more complex modifications.

Sign in to comment.

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!