MATLAB Community

MATLAB, community & more

GUIDE GUIs in All One File

MATLAB has so many features that’s it’s impossible to learn all of them. That’s why it doesn’t surprise me when I meet someone who tells me “it would be great if MATLAB did X” when, in fact, MATLAB does do X. One common request I hear is from people who use GUIDE to create GUIs and do not like distributing both the .fig and .m files.

Sometimes you want to distribute just a single file that represents your GUI. One way to achieve this is to create the GUI by creating all the code yourself. The other is to use our graphical GUI design tools and then Export the final GUI to a single MATLAB file. Like most types of generated code, the resulting file is not as efficiently written as if you created it by hand, but it is certainly a lot faster to make!

You can try it out by creating a GUI in GUIDE, and then using the File -> Export action.

Export the GUI
Save the GUI to a single M-File

In upcoming and exciting news, be sure to check out the Spring Programming Contest on April 13.

  • print


要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。