GUI's OpeningFcn is not ran when opened from the explorer, do I have to open GUI to successfully launch my GUI?

14 次查看(过去 30 天)
I have a GUI that needs to initialize parameters when the opening function is ran, my problem is however that this program will be used by multiple people and I don't want them opening GUIDE in order to get my GUI running properly.
It appears that when opening my reporting_GUI.fig file from the file pane on the left hand side (double-clicking it) that the GUI opens but the OpeningFcn isn't ran. The only way I am able to get the OpeningFcn to run is by first opening GUIDE, and then clicking RUN.
Is there a better way to open/launch a GUI application without opening GUIDE??
Thanks,
Kellen

回答(2 个)

Ilham Hardy
Ilham Hardy 2015-3-26
You can also call the applicable *.mfile from the Matlab command window..
I think when you double click the *.fig file, matlab opens as it is a figure (hence the *.fig extension), therefore no callback is executed.
  2 个评论
Kellen Madsen
Kellen Madsen 2015-3-26
Is there no better way to launch a MATLAB GUI? I mostly inquire because if multiple people use this report generating tool, it would be a lot easier to be able to open a file, or click on an icon, than it would to:
1) open GUIDE first then click run 2) launch the GUI via command prompt (run reporting_GUI.m)
Thanks,
Kellen
Ilham Hardy
Ilham Hardy 2015-3-26
Interesting,
I would suggest deploying your guide gui by using deploytool, but it require a Matlab compiler toolbox.
However, i found similat tread suggesting using a batch from the desktop. thread link
Thanks, i learn new thing today..

请先登录,再进行评论。


Jan
Jan 2015-3-26
You cannot start a GUI by opening the FIG file. This is simply not the right way. You need to run the M-file.
  1 个评论
Kellen Madsen
Kellen Madsen 2015-3-26
You can also not run the M-file without doing so by opening it and running it, or calling it from the command line. I understand that you can't open it by running the FIG file... but there should be a better way of launching a GUI that doesn't come at the cost of creating a stand alone program.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by