GUI with existing function
1 次查看(过去 30 天)
显示 更早的评论
How do you put an existing Matlab function- or more than one function- into a GUI? When I look up tutorials for how to make GUIs, all I see is how to make one from scratch. How can I make a GUI from existing functions and/or data? I have MATLAB_R2015a.
2 个评论
Muthu Annamalai
2015-7-17
Fatih, what the answer from Walter recommends is to keep the GUI parts and computation parts separate.
Walter Roberson
2015-7-17
Heh. My answer did not recommend that, but it is a good point.
My experience is that when my GUI programs grow large enough, my users start to want automation, such as to be able to process a series of files the same way.
Automation can be achieved by writing a routine that activates the GUI step-by-step, including faking clicks, but that approach tends to be very fragile, sometimes failing on minor changes such as the user selecting a different font size.
The other main way to achieve automation is by building in a command language that can be represented as text (so files of commands can be created and edited), and then have the GUI invoke those commands. This approach is more initial work, requiring that a command parser be designed and written, but it is much easier than trying to retrofit automation into a project created as a pure GUI. It is the approach I recommend -- keeping the GUI and the computation separate.
采纳的回答
Walter Roberson
2015-7-17
Create the GUI from scratch. Edit the code for the appropriate callback functions so that they have calls to your existing routines.
更多回答(1 个)
Image Analyst
2015-7-17
You can try MAGIC. http://www.mathworks.com/matlabcentral/fileexchange/24224-magic-matlab-generic-imaging-component. Just plug your code into the AnalyzeSingleImage function. It's a good framework to start out using GUIs.
Description This GUI will help the novice user get up to speed very quickly on using GUI-based applications. Everything is laid out in a very simple Step 1, Step 2, Step 3, etc. layout. It is a very good starting point for a typical image analysis application. This application uses GUIDE to do the user interface design, and has most of the basic controls such as buttons, listboxes, checkboxes, radio buttons, scrollbars, etc. It allows the user to select a folder of images, select one or more images and display them, to select a series of options, and to individually or batch process one or more images. The user can optionally....
2 个评论
Image Analyst
2015-7-17
Faith:
Then you can recreate a generic user interface - one with all the custom controls, whatever you want - if you follow the guidelines in this tutorial: http://blogs.mathworks.com/videos/2013/02/06/introduction-to-gui-building-with-guide-in-matlab/?s_tid=Blog_Videos_Category. Of course it will take time to build in some of the convenient features that MAGIC already has , but maybe you want to do it yourself.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!