Specifications

2 MATLAB GUIs
2-6
Editing Version 5 GUIs with Version 6 GUIDE
In MATLAB Version 5, GUIDE saved GUI layouts as MAT-file/M-file pairs. In
MATLAB Version 6, GUIDE saves GUI layouts as FIG-files. GUIDE also
generates an M-file to program the GUI callbacks, however, this M-file does not
contain layout code.
Use the following procedure to edit a Version 5 GUI with Version 6 GUIDE:
1 Display the Version 5 GUI.
2 Obtain the handle of the GUI figure. If the figure’s handle is hidden (i.e., the
figure’s
HandleVisibility property is set to off), set the root
ShowHiddenHandles property to on.
set(0,'ShowHiddenHandles','on')
Then get the handle from the root’s Children property.
h = get(0,'Children');
This statement returns the handles of all figures that exist when you issue
the command. For simplicity, ensure that the GUI is the only figure
displayed.
3 Pass the handle as an argument to the guide command.
guide(h)
Saving the GUI in Version 6 GUIDE
When you save the edited GUI with Version 6 GUIDE, MATLAB creates a
FIG-file that contains all the layout information. The original MAT-file/M-file
combination is no longer used. To display the revised GUI, use the
open or
hgload command to load the newly created FIG-file, or you can run the
application M-file generated by GUIDE.
Updating Callbacks
Ensure that the Callback properties of the uicontrols in your GUI are set to the
desired callback string or callback M-file name when you save the FIG-file. If
your Version 5 GUI used an M-file that contained a combination of layout code
and callback routines, then you should restructure the M-file to contain only
the commands needed to initialize the GUI and the callback functions. The