Creating Graphical User Interfaces |
|
Saving the Layout
Once you have created the GUI layout, you can save it as a FIG-file (a binary file that saves the contents of a figure) using the Save or Save As item from the File menu. GUIDE generates the M-file automatically when you save or run the figure.
Note
GUI FIG-files that are created or modified with MATLAB 7.0 or a later MATLAB version, are not automatically compatible with Version 6.5 and earlier versions. To make a FIG-file, a kind of MAT-file, backward compatible, you must check the MAT-file Ensure backward compatibility (-v6) preference in the Preferences dialog box under General -> MAT-Files.
|
Renaming GUI Files
Use Save As from the Layout Editor File menu to rename the GUI FIG-file. GUIDE renames the FIG-file and the GUI M-file and also resets the callback properties to properly execute the callbacks.
Exporting a GUI to a Single M-File
You can export a GUI from GUIDE to a single M-file that does not require a FIG-file. This enables you to
- View the layout code for the GUI
- Run the GUI in MATLAB 6.1
Note
If the GUI contains a panel or a button group, you will not be able to run it in MATLAB versions earlier than 7.0.
|
To export your GUI, do the following steps:
- Save the GUI in GUIDE, if you have not already done so.
- Select Export from the File menu. If you changed the GUI since you last saved it, this opens a dialog informing you that exporting will save changes to your figure and M-file, and asking if you want to continue.
- Click OK in the confirmation dialog.
- Save the exported M-file in the Save As dialog. By default, GUIDE gives the exported M-file the name of the GUI M-file with
_export
appended.
Note
If you save a large data set in the GUI figure or in a uicontrol, GUIDE might also export a MAT-file containing the data in addition to exporting an M-file. For example, the data could be saved in a figure or uicontrol UserData property, or in a figure Colormap property. The name of the MAT-file is the same as the exported M-file except for the extension .mat .
|
| Running the GUI | | Displaying the GUI | |
© 1994-2005 The MathWorks, Inc.