Creating Graphical User Interfaces Previous page   Next Page

Programming the GUI M-file

After laying out your GUI, you can program the GUI M-file using the M-file editor. GUIDE automatically generates this file from your layout the first time you save or run the GUI. The GUI M-file

Initially, each callback contains just a function definition line. You then use the M-file editor to add code that makes the component function the way you want it to. To open the M-file, click the M-file Editor icon on the Layout Editor toolbar. The following figure shows the M-file for the GUI with Axes and Menu template.

figure showing the M-file for the GUI with Axes and Menu template

You can view the callback for any of the GUI components by clicking the function icon on the toolbar. This displays a list of all the callbacks, as shown in the following figure.

list of callbacks

Clicking a callback on the list displays the section of the M-file containing the callback, where you can edit it. This example shows the callback template for pushbutton1_Callback.

To learn more about programming the M-file, see Programming GUIs.


Previous page  GUI FIG-Files and M-Files Editing Version 5 GUIs with Version 7 GUIDE Next page

© 1994-2005 The MathWorks, Inc.