Compiled application and -e flag

1 visualización (últimos 30 días)
jason
jason el 8 de Jul. de 2014
Respondida: jason el 9 de Jul. de 2014
Hello. I am trying to deploy a compiled .m file using the Matlab Compiler. I can run the compiled program fine using
mcc -m compiletest.m
However, if I use mcc -e compiletest.m (in order to have no console window appear), the application will open and run, however it will not stay permanently open. My program creates a Java JFrame window. After a few seconds, the JFrame window will close. As I am trying to deploy a JAVA GUI, I would love to remove the console using the -e option. My Guess is that matlab is checking for a matlab figure window, and because there is only a JFrame, it can not find one. Then it exits. Any ideas??
As a simple example, this is compiletest.m
frame = javax.swing.JFrame();
frame.setTitle('any');
frame.setVisible(true);
pause
which creates compiletest.exe
Thanks

Respuesta aceptada

Sanket Mishra
Sanket Mishra el 9 de Jul. de 2014
"pause" is known to cause problem in standalone applications. Modify your code as below so that JFrame will not disappear
frame = javax.swing.JFrame();
frame.setTitle('any');
frame.setVisible(true);
waitfor(frame);
Compile above code using '-e' flag so that the console window does not appear.

Más respuestas (1)

jason
jason el 9 de Jul. de 2014
Beautiful solution. Thank you for your assistance Sanket

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by