4.88889

4.9 | 18 ratings Rate this file 1969 downloads (last 30 days) File Size: 106.84 KB File ID: #24861

35 Complete GUI Examples

by Matt Fig

 

27 Jul 2009 (Updated 27 Oct 2009)

Code covered by BSD License  

35 working GUIs to read and learn.

Download Now | Watch this File

File Information
Description

This is a collection of GUIs meant to serve either to answer specific questions about writing GUIs or as a teaching tool to aid in learning how to write MATLAB GUIs without GUIDE. Many of these are inspired directly from the newsgroup.
 
The questions/files are written in approximate order of complexity, so intermediate users may want to skip the first several files.
The questions answered include:

1. How do I manipulate the strings in a uicontrol?
2. How do make a uicontrol invisible/visible?
3. How do I make a multi-line editbox?
4. How can I let the user of my GUI know his actions are futile (or producing no results)?
5. How can I tell which uicontrol is selected?
6. How can I tell how many times a uicontrol has been activated?
7. How do I tell which button in a buttongroup is selected?
8. How do I let the user know a process is running in the background?
9. How do I control the mouse pointer with a GUI?
10. How can I access the value (current position) of a slider?
11. How can I use different colored strings in a listbox?
12. What is the difference between 'listboxtop' and 'value' in a listbox?
13. How can I make text that can be copied but not changed?
14. How do I allow the user of my GUI to set the range of a slider?
15. How do I use the buttondownfcn on an axes object?
16. How do I make a callback talk to another callback?
17. How can I get the string from a popup or listbox?
18. How can I set the string in a popup or listbox?
19. How can I add to the string in a popup or listbox?
20. How do I tell which figure was current before my callback executed?
21. How do I get data from another GUI?
22. How do I make a GUI to open image files only?
23. How can I make popup choices mutually exclusive?
24. How can I show the current pointer location in axes coordinates?
25. How can I use uicontextmenus?
26. How do I make my GUI control an axes in another figure?
27. What are callback strings?
28. How can I make it so that when one of the figures closes, they all close?
29. How do I make several uicontrols interact in a more complicated GUI?
30. How do I get data from a GUI to the base workspace?
31. How do I make toggle buttons act like tabbed-panels?
32. How can I make a password editbox that has the ***** symbols?
33. How can I use nested function as callbacks?
34. How can I use uiwait in a GUI?
35. How do I use JAVA in my GUI?
36. How do I force the figure to maintain focus between uicontrol activations?
37. How do I save an axes as an image?
38. How can I make a simple drawing program?
39. How can I save the state of a system of GUIs to use later?

I am open to hearing any suggestion as to other questions which could be covered in the collection. Such suggestions need not be basic. Please read the pdf file prior to use. Also the contents.m file contains brief descriptions of each GUI.

Please email me if an error is found, either in the documentation or coding. Thanks.

MATLAB release MATLAB 7.4 (R2007a)
Zip File Content  
Other Files
GUIS_FEX/contents.m,
GUIS_FEX/GUI_1.m,
GUIS_FEX/GUI_10.m,
GUIS_FEX/GUI_11.m,
GUIS_FEX/GUI_12.m,
GUIS_FEX/GUI_13.m,
GUIS_FEX/GUI_14.m,
GUIS_FEX/GUI_15.m,
GUIS_FEX/GUI_16.m,
GUIS_FEX/GUI_17.m,
GUIS_FEX/GUI_18.m,
GUIS_FEX/GUI_19.m,
GUIS_FEX/GUI_2.m,
GUIS_FEX/GUI_20.m,
GUIS_FEX/GUI_21.m,
GUIS_FEX/GUI_22.m,
GUIS_FEX/GUI_23.m,
GUIS_FEX/GUI_24.m,
GUIS_FEX/GUI_25.m,
GUIS_FEX/GUI_26.m,
GUIS_FEX/GUI_27.m,
GUIS_FEX/GUI_28.m,
GUIS_FEX/GUI_29.m,
GUIS_FEX/GUI_3.m,
GUIS_FEX/GUI_30.m,
GUIS_FEX/GUI_31.m,
GUIS_FEX/GUI_32.asv,
GUIS_FEX/GUI_32.m,
GUIS_FEX/GUI_33.m,
GUIS_FEX/GUI_34.m,
GUIS_FEX/GUI_35.m,
GUIS_FEX/GUI_4.m,
GUIS_FEX/GUI_5.m,
GUIS_FEX/GUI_6.m,
GUIS_FEX/GUI_7.m,
GUIS_FEX/GUI_8.m,
GUIS_FEX/GUI_9.m,
GUIS_FEX/Usage_Notes.pdf,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (27)
28 Jul 2009 us

this first class ML senior has offered an enormous amount of time to create this exhaustive suite of working and highly educational GUI examples to our community...
both novices, in particular, as well as more advanced users will find a lot of good stuff in those exemplary functions...
this submission certainly will find its way into many CSSM threads as a hint for solutions as well as good programming practice...

altogether, hats off not only to a ML cognoscente but also to a teacher who clearly seems to be fond of people 'doing' ML...

us

ps: matt, what about a small CONTENTS.M, which would be easier than the (nice) PDF you proved (just a pedestrian thought)...

28 Jul 2009 Matt Fig

I like the contents.m idea, and I might as well since a typo has already been found.

In the pdf I refer to a comment in GUI_30. I should have put GUI_32. File will be updated.

28 Jul 2009 someone

A VERY useful submision for all ages of programmers.

In GUI_12, I have to actually click on the the "color" to get the "print choice" button to work properly. Otherwise the last color "selected" is printed (not current displayed color).
Bug or feature?

A (very minor) typo in GUI_24 on line 23:
% No make a simple plot.
should be:
% Now make a simple plot.

This submission could easlily become the MATLAB GUI FAQ!
Great job Matt!!!

28 Jul 2009 Matt Fig

Thanks someone,
BUG! I should be using listboxtop, not value. Thanks, I will update that too.
Also, the suggestions for added exercises are coming into my email. Keep them coming! Any other GUI suggestions are welcome, simple or complex.

29 Jul 2009 Darren Rowland

A stellar FEX contribution. Must read material
for any GUI developer.

30 Jul 2009 manoj singh

awesome work really very helpful

05 Aug 2009 Vishakha Bhagat  
09 Aug 2009 Arnaud Thabot  
11 Aug 2009 Luigi Giaccari  
11 Aug 2009 creek

thank you for understanding, and this is a great set and deserve a 5star for its completeness.

11 Aug 2009 Ahmed  
13 Aug 2009 Tanguy

Absolutely Superb !!

Thanks for such a didactic, well commented set of example. The exercises are a great idea too.

One thing you never touched though, is the resizing of the GUIs. Was that intentional ?

13 Aug 2009 Matt Fig

Tanguy,
You are correct. I didn't mention resizable GUIs because I make all of my own GUIs non-resizable. Is there something you have in mind in particular? If so email me with your suggestion, and I may include it in the next update. Thanks.

06 Sep 2009 CyberFrog

Hi matt, great collection of gui examples, really useful!

I have 2007b and I tried running example 25 but no menu title appears, is this a compatibility problem?

One more question too being an absolute beginner here, how come no .fig file is generated when running the .m file code? i.e. in guide this is automatically generated?

Cheers

Cyberfrog

06 Sep 2009 Matt Fig

Hello CyberFrog,
I am not sure what you mean by a "menu title" in GUI_25. There isn't supposed to be a menubar, if that is what you mean. I am using 2007b, and everything looks like it should here.

No *.fig file is generated because these are M-file GUIs. GUIDE works by generating two files, an M-File which has the code, and a figure file which has the graphics. These are simply two different ways of doing GUIs in MATLAB. I much prefer to write my GUIs without GUIDE for many reasons, only one of which is that I need to keep track of only one file!

This collection, as is stated in the description, is meant to help people write GUIs without using GUIDE.

07 Sep 2009 CyberFrog

Hi Matt,
Woops, I thought the uimenu function was for the menu bar only.
Is it fair to assume then that if a gui is programmed without guide and you wish to add a menu bar, the property menubar is the only way to do it? Sorry for the general question but I have just been lucky enough to take on this rather large code which I think was not written in guide to start with (but it still has a .fig file).

Do you happen to have an example with a customised menubar gui that is programmed without using guide?

Like yourself I am very much inclined to program GUI's rather than using GUIDE.

Many thanks

07 Sep 2009 Matt Fig

Cyberfrog,
GUI_34 has a custom menubar. None of the GUIs in this collection are programmed with GUIDE. Please email me if you have more questions.

11 Sep 2009 vivian Fang

These are really helpful. Thank you very much!

29 Sep 2009 Herve  
22 Oct 2009 Alain  
23 Oct 2009 Ashwini Deshpande  
26 Oct 2009 Krishna Lalith

Excellent. Great Job.

26 Oct 2009 Ashwini Deshpande

In GUI_32, if i press the delete button(key), it does not delete the next character instead it will consider it as a character and adds to the existing string

03 Nov 2009 Ahsan Chaudhry

Awesome.... You made my day!!! I was struggling with gui... thanks a lot...

09 Nov 2009 Rachel Laughs

What an amazing collection. Thank you so much for this!

Is there an available "answer guide" for the suggested exercises you have listed in the files? I am sadly already stuck on the second one and don't want to move on until I understand it

13 Nov 2009 Rachel Laughs

Okay wow. I know I already posted feedback, but this set of examples is so amazing as a tutorial that I had to come back and say that every beginner should study this entire package. This has to be the best file I've found all year, hands down. Thank you for providing this!!

16 Nov 2009 Damien Altzheim

Awesome!! Just what I was looking for.

Please login to add a comment or rating.
Updates
29 Jul 2009

Fixed typos, added a contents.m file.

04 Aug 2009

Added 3 GUIs, expanded suggested exercises.

10 Aug 2009

User suggestions and correction have been incorporated.

27 Oct 2009

Fixed typos and inconsistencies due to user feedback.

Tag Activity for this File
Tag Applied By Date/Time
gui Matt Fig 28 Jul 2009 10:58:13
example Matt Fig 28 Jul 2009 10:58:13
files Matt Fig 28 Jul 2009 10:58:13
guide Matt Fig 28 Jul 2009 10:58:13
how to Matt Fig 17 Aug 2009 22:39:21
learn Matt Fig 17 Aug 2009 22:39:21
learning Matt Fig 17 Aug 2009 22:39:21
help Matt Fig 17 Aug 2009 22:39:21
tips Matt Fig 17 Aug 2009 22:39:39
example Bill 19 Aug 2009 21:28:43
example mario 21 Aug 2009 14:19:59
example Bjørn Helge Østerås 24 Aug 2009 07:43:55
files Aman P.V. P.V 30 Sep 2009 14:39:55
gui Paulo 07 Oct 2009 09:05:52
example Goran 20 Oct 2009 21:01:49
example ILIYA 22 Oct 2009 14:24:45
example Niccolo' Bulgarini 29 Oct 2009 10:13:59
example Gushter Hodzic 16 Nov 2009 13:47:46
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com