直接在MATLAB环境中从桌面(快捷方式)打开GUI [英] Open a GUI directly from desktop (Shortcut) in MATLAB environment
问题描述
我想直接从桌面打开GUI,而无需打开MATLAB并从中运行它.当我右键单击主MATLAB code
文件并在Windows环境中选择Run
时,MATLAB启动,然后我的GUI自动运行,但是我希望双击桌面上的Icon(快捷方式)来运行它.我怎样才能做到这一点?我不想编译我的应用程序.
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.
- 我的GUI包含训练神经网络,所以我无法对其进行编译.
推荐答案
您真正需要的是一种通过命令行运行.m
文件的方法-这不是特定于GUI的操作.命令行操作是可以绑定到桌面上的快捷方式或使用批处理文件执行的操作.
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.
您要寻找的解决方案是 MATLAB专用语法和
The solution you're looking for is a combination of MATLAB-specific syntax and a straightforward batch file creation procedure:
-
打开文本编辑器.
Open a text editor.
在内部写入此内容:
"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');"
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');"
将文件另存为.bat
(在Windows中)并运行.
Save the file as .bat
(in windows) and run.
这篇关于直接在MATLAB环境中从桌面(快捷方式)打开GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!