Main Content

Preferences

Open Preferences window to view and change preferences

Description

MATLAB®provides various preferences for customizing MATLAB. You can use the Preferences window to access and set MATLAB preferences.

Some preferences are not available inMATLAB Online™.

Open the Preferences

To open the Preferences window, do one of the following:

  • MATLAB Toolstrip: On theHometab, in theEnvironmentsections, clickPreferences.

  • MATLAB command prompt: Enterpreferences.

To view or change preferences for MATLAB or related products, in the left pane of the Preferences window, select a product and then select from the available categories. Change preferences in the right pane of the Preferences window and then clickApplyorOKto accept the changes.

Preferences take effect immediately and remain persistent across sessions of MATLAB.

Examples

expand all

Open the Preferences window with the MATLAB Colors Preferences page selected.

preferencesColors

In theMATLAB output colorssection, select the colors that you want to use from theError text,Warning text, andHyperlinkscolor palettes. The new colors appear in theCommand Window samplearea.

Preference window displaying the MATLAB Colors Preferences page

Programmatic Use

expand all

preferencesopens the Preferences window. If the Preferences window is already open, MATLAB brings focus to the tool.

You also can access and set some MATLAB options programmatically using settings. For more information, seeAccess and Modify Settings.

example

preferencespageopens the Preferences window and selects the specifiedpage.

example

More About

expand all

Tips

  • To restore the default preferences for a given release of MATLAB, delete all of the files in the corresponding preferences folder. Use theprefdircommand to determine the full path of the preferences folder.

    For example, to restore the default preferences for R2021a, typeprefdirin the Command Window to determine the location of the preferences folder.

    prefdir
    ans = ' C: \ \用户用户名\ AppData \ \ MathWorks徘徊\MATLAB\R2021a'
    Close MATLAB, delete all of the files in the folderC:\Users\username\AppData\Roaming\MathWorks\MATLAB\R2021aand then start MATLAB again. MATLAB starts with all preferences set to their default values.

    One file to consider keeping ishistory.m. For more information, seeSet Command History Preferences.

版本历史

Introduced before R2006a