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 Comments

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.
Thanks for your comment. I am going to ask if it is possible to install MCR then for further decide how to proceed. Regarding GUIDE option of Matlab, is it possible to include in a callback the call coming from a .m script or from a matlab function created?
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.
What I meant is that I have all the code in Matlab and the graphs have been also defines in a specific script. In reality I have several scripts linked ones to the others. Now, I am using GUIDE to plot different ones and my question is: could I just make a reference into the callback code to the script in which the specific graph I want to show is located?
Yes, GUIDE creates MATLAB code (and a .fig file). You can edit the MATLAB code to call whatever you want.
I was more referring to the fact that I have the MATLAB code and I want to "call" it in GUIDE. Is this possible?
GUIDE is just an edit tool. You can call any function or script from any callback.
Thanks, I've been doing some research on the callbacks but so far, I've seen that the syntaxis is different from Matlab so I can not copy the script as such or call it as a function or similar. Am I wrong? Is it possible to have interactive tabs on an app designed with GUIDE?
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
"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.
Thanks to both of you. I am trying my best to use GUIDE. I will follow your instructions. I have been suggested to use App Designer better, any comments on that?

Sign in to comment.

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Asked:

on 20 May 2018

Commented:

on 23 May 2018

Community Treasure Hunt

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

Start Hunting!