Be the first to rate this file! 5 Downloads (last 30 days) File Size: 7.08 KB File ID: #24127

GUIDE with nested callbacks

by Sean Little

 

15 May 2009

Utility that automatically generates m-files with nested callbacks.

| Watch this File

File Information
Description

Tired of using USERDATA or GUIDATA calls to share data between callbacks in GUIDE? Nested callbacks are the answer. A nested function can "see" all the data that the top level function can. You therefore no longer need to painstakingly save or pass data for later use.

Unfortunately, up until now using nested functions meant giving up the convenience of using GUIDE to define the layout of your GUI. GUIDE does not natively support nested callbacks. This utility solves that problem.

First do all the layout of GUI objects in GUIDE. Then use the Tools -> GUI Options menu to select "Generate FIG file only". Then call the enclosed NESTED_GUI function according to the documented syntax such as the following:

>> nested_gui my_gui.fig

An m-file called "my_gui.m" will then be automatically generated that uses nested callback functions.

Note that this utility can also replace the FIG file with a text file that can be edited and used in a code repository. I call this "text layout mode". See the header help for more details.

Please note that I have assumed that users of this function have a certain familiarity with MATLAB and GUIDE. If you are new to MATLAB and GUI creation, I suggest that you read about GUIDE and nested functions before you attempt to use this utility.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
gui Sean Little 15 May 2009 15:04:09
nested functions Sean Little 15 May 2009 15:04:10
callbacks Sean Little 15 May 2009 15:04:10

Contact us at files@mathworks.com