How to create an executable? Should I create a GUI first (GUI or AppDesign)?
古いコメントを表示
Good morning, I need to create an interface that later on can be exchange via an executable file for users who do not have Matlab. I am not a programmer expert. Should I build the app first and later the application compiler? Should I use the App Designer option or the GUI option? Thank you very much.
11 件のコメント
Rik
2018 年 5 月 20 日
If it is ok to require your users to install the MCR (which is usually free), you can compile your project to an exe. I never worked with the AppDesigner, so I don't really know how that works. If you need a stand-alone executable without the MCR, try to convert you code to C, and then compile that.
Another option would be to use Octave to distribute your code. It is less ideal in every way except for cost. Octave is free, but is slower, has less functions, is harder to debug, etc.
Blanca Larraga
2018 年 5 月 20 日
Rik
2018 年 5 月 20 日
I don't understand your question. Could you explain it a bit more?
As a note on GUIDE: I personally don't use GUIDE for more than the first sketch of my GUI. Adapting GUIDE code is very difficult and the function calls are quite convoluted. In my mind it flies in the face of the KISS programming principle. You can just make a figure window with the figure function, and the objects can all be created with the uicontrol function. Read the doc for guidata and you are ready to write your own GUI. That should make your function much easier to maintain.
Blanca Larraga
2018 年 5 月 20 日
Walter Roberson
2018 年 5 月 20 日
Yes, GUIDE creates MATLAB code (and a .fig file). You can edit the MATLAB code to call whatever you want.
Blanca Larraga
2018 年 5 月 20 日
Rik
2018 年 5 月 20 日
GUIDE is just an edit tool. You can call any function or script from any callback.
Blanca Larraga
2018 年 5 月 20 日
Rik
2018 年 5 月 20 日
GUIDE just results in normal code. You can set the callback property of certain objects to a function. You can see a small example below. Just read the documentation for uicontrol and guidata and you should be able to even do this without GUIDE.
%put this is the function that makes your GUI figure
uicontrol('Parent',handle_to_fig,...
'style','radio',...
'Value','off',...
'String','foo',...
'Units','Normalized',...
'Position',[0.1 0.1 0.8 0.8],...
'Callback',@tiny_function)
%make sure this function is on the Matlab path
function tiny_function(hObject,eventdata)
%if you need the handles struct you can call handles=guidata(hObject);
val=get(hObject,'Value');
if val
msgbox('radiobutton is now on')
else
msgbox('radiobutton is now off')
end
Walter Roberson
2018 年 5 月 20 日
"Am I wrong?"
Yes, you are wrong. The code generated by GUIDE is purely MATLAB and uses only MATLAB syntax. It does, however, arrange so that each user callback has a third parameter, handles, to make it easier to manage data sharing.
"Is it possible to have interactive tabs on an app designed with GUIDE?"
Unfortunately tabs were not implemented in the GUIDE layout tools. When GUIDE was designed, it did not take into account that different objects might be overlapping on the screen, just not in use at the same time.
It is possible to program tabs yourself, since the code generated by GUIDE is MATLAB code, but at that point you will likely find yourself fighting GUIDE.
Blanca Larraga
2018 年 5 月 23 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!