GUIDE Preferences

Set Preferences

You can set preferences for GUIDE. From the MATLAB® Home tab, in the Environment section, click Preferences. These preferences apply to GUIDE and to all GUIs you create.

The preferences are in different locations within the Preferences dialog box:

Confirmation Preferences

GUIDE provides two confirmation preferences. You can choose whether you want to display a confirmation dialog box when you

  • Activate a GUI from GUIDE.

  • Export a GUI from GUIDE.

  • Change a callback signature generated by GUIDE.

In the Preferences dialog box, click MATLAB > General > Confirmation Dialogs to access the GUIDE confirmation preferences. Look for the word GUIDE in the Tool column.

Prompt to Save on Activate

When you activate a GUI from the Layout Editor by clicking the Run button , a dialog box informs you of the impending save and lets you choose whether or not you want to continue.

Prompt to Save on Export

From the Layout Editor, when you select File > Export, a dialog box informs you of the impending save and lets you choose whether or not you want to continue.

For more information on exporting a GUI, see Create a Programmatic GUI Code File from GUIDE GUI Files.

Backward Compatibility Preference

MATLAB Version 5 or Later Compatibility

GUI FIG-files created or modified with MATLAB 7.0 or a later version are not automatically compatible with Version 6.5 and earlier versions. GUIDE automatically generates FIG-files, which are a kind of MAT-file, to hold layout information for GUIs.

To make a FIG-file backward compatible, from the Layout Editor, select File > Preferences > General > MAT-Files, and then select MATLAB Version 5 or later (save -v6).

    Note:   The -v6 option discussed in this section is obsolete and will be removed in a future version of MATLAB.

All Other Preferences

GUIDE provides other preferences, for the Layout Editor interface and for inserting code comments. In the Preferences dialog box, click GUIDE to access these preferences.

The following topics describe the preferences in this dialog:

Show Names in Component Palette

Displays both icons and names in the component palette, as shown below. When unchecked, the icons alone are displayed in two columns, with tooltips.

Show File Extension in Window Title

Displays the GUI FIG-file file name with its file extension, .fig, in the Layout Editor window title. If unchecked, only the file name is displayed.

Show File Path in Window Title

Displays the full file path in the Layout Editor window title. If unchecked, the file path is not displayed.

Add Comments for Newly Generated Callback Functions

Callbacks are blocks of code that execute in response to actions by the GUI's user, such as clicking buttons or manipulating sliders. By default, GUIDE sets up templates that declare callbacks as functions and adds comments at the beginning of each one. Most of the comments are similar to the following.

% --- Executes during object deletion, before destroying properties.
function figure1_DeleteFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

Some callbacks are added automatically because their associated components are part of the original GUIDE template that you chose. Other commonly used callbacks are added automatically when you add components. You can also add callbacks explicitly by selecting them from View > View Callbacks menu or on the component's context menu.

If you deselect this preference, GUIDE includes comments only for callbacks that are automatically included to support the original GUIDE template. GUIDE does not include comments for callbacks subsequently added to the code.

See Write Callbacks Using the GUIDE Workflow for more information about callbacks and about the arguments described in the preceding comments.

Was this topic helpful?