How to convert .m file to .exe file?

6 次查看(过去 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 个评论
Nipurn Gulgulia
Nipurn Gulgulia 2018-4-12
No, I am not getting any error or warning. In Log file its showing this-
Dependency analysis by REQUIREMENTS.
[Warning: Duplicate directory name:
C:\eng_apps\matlab2014a\toolbox\coder\simulinkcoder\cgv\API]
[> In path at 33
In requirements at 156]
[Warning: Duplicate directory name:
C:\eng_apps\matlab2014a\toolbox\matlab\winfun\NET]
[> In path at 33
In requirements at 156]
[Warning: Duplicate directory name:
C:\eng_apps\matlab2014a\toolbox\rtw\targets\AUTOSAR\AUTOSAR]
[> In path at 33
In requirements at 156]
[Warning: Duplicate directory name:
C:\eng_apps\matlab2014a\toolbox\rtw\targets\AUTOSAR\AUTOSAR\dataclasses]
[> In path at 33
In requirements at 156]
[Warning: Duplicate directory name:
C:\eng_apps\matlab2014a\toolbox\simulink\simulink\MPlayIO]
[> In path at 33
In requirements at 156]
[Warning: Duplicate directory name:
C:\eng_apps\matlab2014a\toolbox\slvnv\reqmgt\RTExplorer]
[> In path at 33
Nipurn Gulgulia
Nipurn Gulgulia 2018-4-12
I tried with below simple function also, i am getting same thing. It show splash screen and than close!
function Test_1(varargin)
GUIsize = [520 420 520 420];
parent = figure('Name','Work Load','NumberTitle','off',...
'Menubar','none');
set(parent, 'Units', 'pixels', 'Position', GUIsize);
ProjectPanel = uipanel(parent, 'Title', 'Projects',...
'Position', [0, .01, .505,.91]);
TimePanel = uipanel(parent, 'Title', 'Time Spent',...
'Position',[.5, .01, .495,.91]);
Top = uipanel(parent, 'Position', [0, .905, .997,.0875]);
Add = uicontrol(parent, 'Units', 'norm',...
'Position', [0.24, 0.917, 0.11, 0.067], 'String', 'Add','FontSize', 9);
Save = uicontrol(parent, 'Units', 'norm',...
'Position', [0.37, 0.917, 0.11, 0.067],'String', 'Save','FontSize', 9);
end

请先登录,再进行评论。

采纳的回答

Steven Lord
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 个评论
Nipurn Gulgulia
Nipurn Gulgulia 2018-4-12
I tried this but still the same result! I even tried with removing function and directly save the code and complied it but in all the cases i am getting same result! No error or warning message!
Steven Lord
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
Veera Kanmani 2018-4-12

类别

Help CenterFile Exchange 中查找有关 Software Development Tools 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by