Reputation:
I've used the Matlab Compiler to create a .exe file. The program takes 15 sec to start. I would like to hide the console window, and display a custom splash screen. How can I do that?
Upvotes: 4
Views: 2147
Reputation: 23898
To get rid of the DOS window, use mcc -e
instead of mcc -m
. See "MATLAB Compiler > Function Reference" in the online documentation, brought up by doc()
. You might not want to do that, though: the DOS window is the output of last resort; it's where unhandled exceptions, core dumps, and other diagnostic output go. At least make it an option so you can have a debug build that has the DOS window.
In my experience, the startup overhead for a compiled standalone Matlab program happens before control transfers to user M-code, so a splash screen will need to be done in an external program, or hooked in to the C wrapper that mcc
generates. You could use Michael J's suggestion of writing a launcher. You're not looking for matlab.exe
or a Matlab desktop window, though, since this is a standalone app. To detect when the Matlab program has started, have your M-code write out a little temp file as the first thing the program does, and have your launcher watch for that.
Upvotes: 0
Reputation: 125874
With regard to making a splash screen, there are a few submissions on The MathWorks File Exchange that deal with just that:
I haven't used any of them personally, but they should at the very least give you some guidance if you want to design your own splash screen functionality.
Upvotes: 2
Reputation: 7939
You can write a "launcher" program.
The launcher would
The tricky bit will be determining when the matlab program has started. One method might be to call EnumWindows() and GetWindowText() in a loop, looking for the matlab window title, but you might be able to come up with a better way given knowledge of what the matlab program does.
You would probably need to keep checking that the matlab process hasn't died, in case something goes wrong.
Upvotes: 0