ayaan
ayaan

Reputation: 735

Open a MATLAB GUI from terminal

I am new to MATLAB GUI programming. I have designed a GUI using MATLAB GUIDE and saved it as a .fig file and I have written a .m file and linked both the files.

Now I start my GUI by opening MATLAB and then from the MATLAB command line I invoke it. This works fine, but now I want open my GUI directly from the Linux terminal command line by a command instead of opening MATLAB and then opening the GUI.

Is there a way to do it? I can't create an executable file, because I don't have MATLAB compiler tool box. How do I do this?

Upvotes: 1

Views: 5380

Answers (1)

Thomas Ibbotson
Thomas Ibbotson

Reputation: 745

If you don't have the MATLAB Compiler you cannot run your GUI without also running the MATLAB process. However, you can run your GUI without the MATLAB desktop showing, which I think is what you want. If your GUI main function is called myGUI you could run this command from a linux terminal:

matlab -nodesktop -r "myGUI"

MATLAB will still run in your terminal, so you might want to add a CloseRequestFcn that exits MATLAB. See http://www.mathworks.com/help/matlab/ref/figure-properties.html#prop_CloseRequestFcn.

Upvotes: 3

Related Questions