How to convert .m file to .exe file?
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Steven Lord
2018-4-12
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 个评论
Steven Lord
2018-4-12
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.
更多回答(1 个)
Veera Kanmani
2018-4-12
https://in.mathworks.com/matlabcentral/answers/318886-how-can-i-create-exe-file-from-m-file
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Software Development Tools 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!