GUI with existing function

1 回表示 (過去 30 日間)
Faith McColl
Faith McColl 2015 年 7 月 17 日
コメント済み: Walter Roberson 2015 年 7 月 17 日
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
Muthu Annamalai 2015 年 7 月 17 日
Fatih, what the answer from Walter recommends is to keep the GUI parts and computation parts separate.
Walter Roberson
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
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 件のコメント
Faith McColl
Faith McColl 2015 年 7 月 17 日
Thank you! I will refine my research and figure out how to do that.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
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 件のコメント
Faith McColl
Faith McColl 2015 年 7 月 17 日
Thank you, but I would rather not download anything outside the Matlab program I currently have.
Image Analyst
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 ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by