Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
541 views
in Technique[技术] by (71.8m points)

user interface - Open a GUI directly from desktop (Shortcut) in MATLAB environment

I want open a GUI directly from desktop without opening MATLAB and run it from it. When I right click on the main MATLAB code file and select Run in windows environment, MATLAB starts and after that my GUI automatically runs but I want have this with double clicking on an Icon (shortcut) o desktop. How can I do this? I don't want compile my app.

  • My GUI contains training neural network so I can't compile it.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

What you actually need is a way to run .m files via the command line - an action which isn't specific to GUIs. A command line operation is something you can bind to a shortcut on your desktop or execute using a batch file.

The solution you're looking for is a combination of MATLAB-specific syntax and a straightforward batch file creation procedure:

  1. Open a text editor.

  2. Write this inside: "C:<path to your MATLAB folder>matlab.exe" -nodisplay -nosplash -nodesktop -r "cd('C:<path to your where the .m file is>'); run('C:<path to where the .m file is>mfile.m');"

  3. Save the file as .bat (in windows) and run.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...