How to convert .m file to .exe file?
4 views (last 30 days)
Show older comments
Nipurn Gulgulia
on 12 Apr 2018
Commented: Steven Lord
on 12 Apr 2018
I converted .m file to .exe file using deploytool. When i run .exe file it opens with logo and just after that it close. Its not through any error or warning message. I am not able to figure out why its happening!! .m file contains classdef, in which using uicontrol i am creating GUI. Is it because i don't have any .fig file ? Thanks!
6 Comments
Accepted Answer
Steven Lord
on 12 Apr 2018
Does your GUI use uiwait or waitfor to pause execution until the GUI is closed? If it does not, I believe what's happening is that the executable is opening your GUI and as soon as the GUI's program file finishes executing it exits, closing all figures as part of its shutdown process. [If it didn't, it would leak memory and graphics handles.] Adding uiwait or waitfor will prevent the GUI's program file from finishing until you close the GUI figure, and that would keep the executable running while you interact with your GUI.
If your GUI does use uiwait or waitfor, try launching the executable by typing its name at your operating system's command prompt rather than double-clicking on its icon. If it experiences an error on startup, that should display the message at the prompt. That may suggest a solution to you, or you can copy it into a comment on this question and that may suggest a solution to some of the people reading this discussion.
4 Comments
Steven Lord
on 12 Apr 2018
I tried building the application in release R2018a using the code you posted and was able to get a running application that left the figure on screen until I closed it myself. If you're not seeing the same results, you may want to contact Technical Support and work with them to determine why your results are different from mine. Use the Contact Us link in the upper-right corner of this page to contact Support.
More Answers (1)
Veera Kanmani
on 12 Apr 2018
https://in.mathworks.com/matlabcentral/answers/318886-how-can-i-create-exe-file-from-m-file
See Also
Categories
Find more on Software Development Tools 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!