Skip to Main Content Skip to Search
Product Documentation

About Preferences

Set Preferences for MATLAB

MATLAB provides a variety of options called preferences for customizing MATLAB. To access and set preferences:

  1. Select File > Preferences.

  2. From the left pane of the Preferences dialog box, select a tool, product, or an entry revealed when you click a plus sign (+) preceding a tool or product name.

  3. Change settings in the right pane of the Preferences dialog box.

  4. Click Apply or OK.

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

Function Alternative

Open the Preferences dialog box using the preferences function.

Where MATLAB Stores Preferences

MATLAB and other MathWorks products store their preferences in the file matlab.prf. This file loads when you start MATLAB. The folder containing this file is called the preferences folder. The preference folder also contains other related files.

The Path to and File Name for the Preferences Folder

To see the full path for the folder where matlab.prf and related files are located, type prefdir in the MATLAB Command Window.

On Apple Macintosh platforms, the folder can be in a hidden folder, for example, myname/.matlab/R2009b. If so, to access the hidden folder:

  1. In the Apple Mac OS® Finder tool, select Go > Go to Folder.

  2. In the resulting dialog box, type the path returned by prefdir, and then press Enter.

The name of the preferences folder, matches the name of the release. For instance, for MATLAB R2010b, the name of the preferences folder is R2010b.

Effects of Changing Preferences

When you change preferences using the MATLAB Desktop (File > Preferences), it updates matlab.prf. When you close MATLAB, it saves those changes to matlab.prf.

Effects of Installation and Deinstallation on the Preferences Folder

Installing MATLAB has no effect on the preferences folder. That is, MATLAB creates, checks, copies, and writes to the preferences folder when you start up MATLAB, not when you install it. When you deinstall MATLAB, there is an option in the uninstaller to remove the preferences folder. However, this option is not selected by default.

Preferences Folder and Files MATLAB Uses When Multiple MATLAB Releases Are Installed

The files in the preferences folder that MATLAB uses depends on the version of MATLAB you are starting up. How and if MATLAB migrates (reuses) preferences files from one version to the next also depends on the version.

Process MATLAB Uses to Create and Migrate the Preferences Folder and its Files

When you start it up, MATLAB looks for a preferences folder name that matches the release starting up, and then does one of the following:

Control the Preferences Files MATLAB Uses

This table describes how to control which versions of preferences files MATLAB uses.

To Use:Do This:

Default preference files for a given release of MATLAB

Make sure the preferences folder for that release exists, but is empty before starting up that MATLAB version.

All the preference files from the release of MATLAB immediately preceding the release you plan to start up.

Ensure that the preferences folder exists for that preceding release. If so, delete the entire preferences folder for the release of MATLAB you plan to start up.

The release-specific default for just a particular file in the preferences folder

Delete just that file from the preferences folder for the release of MATLAB you plan to start up.

One file to consider keeping is history.m. For more information, see Command History File — history.m.

General Preferences

You can set preferences for toolbox path caching, figure window printing, and deleting files.

Select File > Preferences > General, and then adjust preference options as described in this table.

PreferenceUsage
Toolbox path caching

Select Enable toolbox path caching to have MATLAB cache toolbox folder information across sessions for quicker startup performance.

Select Enable toolbox path cache diagnostics to display information about startup time when you start MATLAB.

Click Update Toolbox Path Cache to add files to the toolbox folders under the matlabroot folder. (Use after you use tools not provided with MATLAB to create MATLAB files.)

For details, see Toolbox Path Caching in the MATLAB Program.

Figure window printing

Select an option to specify how colored lines and text appear in printed output.

Deleting Files

Select an option to specify what MATLAB does with files you delete using the delete function.

Selecting Delete permanently makes the delete function run faster.

For details, see Deleting Files and Folders Using Functions.

MAT-Files Preferences

You can set the default MATLAB version for MAT-files and FIG-files. These preferences apply to both the save function and the Save menu options. However, the matfile function creates only Version 7.3 MAT-files.

To set MAT-Files preferences, select File > Preferences > General > MAT-Files, and then adjust preference options as described in the table below.

For more details on the features supported in each version, see the save reference page.

OptionUse to:
MATLAB Version 7.3 or later (save -v7.3)

Load or save parts of variables, or save variables larger than 2 GB on 64-bit systems. As with Version 7, files are compressed and use Unicode® character encoding.

MATLAB Version 7 or later (save -v7)

Save compressed MAT-files that use Unicode character encoding. This is the default on new installations of MATLAB software and upgrades from versions earlier than 7.3.

MATLAB Version 5 or later (save -v6)

Save MAT-files for use with versions prior to MATLAB Version 7, or create uncompressed files.

Confirmation Dialogs Preferences

You can specify whether or not MATLAB displays specific confirmation dialog boxes.

Select File > Preferences > General > Confirmation Dialogs, and then adjust preference options as described in the table below.

This table summarizes the core MATLAB confirmation dialog boxes. There might be additional confirmation dialog boxes for other products you install.

Option

Confirmation Dialog Box Appears

Warn before deleting Command History items

When you delete entries from the Command History window.

For details, see Delete Entries from the Command History Window .

Warn before clearing the Command Window

When you clear the Command Window content by selecting Edit > Clear Command Window. Does not appear when you use the clc function.

Confirm when overwriting variables in MAT-files

When you save variables by dragging them from the Workspace browser onto a MAT-file in the Current Folder browser.

For details, see Creating and Updating MAT-Files with the Current Folder Browser.

Prompt when editing files that do not exist

When you type edit filename and filename does not exist in the current folder or on the search path.

Prompt to exit debug mode when saving file

When you try to save a modified file while in debug mode.

For details, see End Debugging.

Prompt to save on activate

When you have unsaved changes to a figure and program file and you activate the GUI by clicking the Run button, for example.

For details, see GUIDE Preferences.

Prompt to save on export

When you have unsaved changes to a figure and program file and you select File > Export.

For details, see GUIDE Preferences.

Confirm changing default callback implementation

When you have modified a callback signature in GUIDE.

For details, see GUIDE Preferences.

Confirm before exiting MATLAB

When you quit MATLAB.

For details, see Quitting MATLAB.

Warn about missing search databases

When you have help files in the Help browser for products not produced by MathWorks and the search database for those files has not been updated for the version of MATLAB you are running.

For more information, contact the provider of the help files to obtain the correct version of the search database. Without the most current version, you can use the help files in the Help browser, but the Help browser search will not include those files in search results.

Confirm when deleting variables

When you delete variables from the workspace using menu items. Does not appear with the clear function.

For details, see Deleting Workspace Variables.

Source Control Preferences

You can select which previously installed and configured source control system to use with MATLAB.

Select File > Preferences > General > Source Control, and then select an option from the drop-down menu.

For detailed information on setting up and using a source control system with MATLAB, see Setting Up the Source Control Interface on Microsoft Windows and Source Control Interface on UNIX Platforms.

Java Heap Memory Preferences

You can adjust the amount of memory that MATLAB software allocates for Java objects.

To adjust the Java heap size:

  1. Select File > Preferences > General > Java Heap Memory.

  2. Select a Java heap size value using the slider or spin box.

      Note   Increasing the Java heap size decreases the amount of memory available for storing data in arrays.

  3. Click OK.

  4. Restart MATLAB.

If the amount of memory you specified is not available upon restart, MATLAB resets the value to the default, and displays an error dialog box. To readjust the value, repeat the previous steps.

If increasing the heap size does not eliminate memory errors, check your Java code for memory leaks. Eliminate references to objects that are no longer useful. For more information, see the Java SE Troubleshooting guide at http://www.oracle.com/technetwork/java/javase/index-138283.html.

Keyboard Shortcuts Preferences

You can set keyboard shortcuts for actions you perform using MathWorks software. You can specify or import sets of predefined keyboard shortcuts, set individual shortcuts on an action-by-action basis, or use a combination of both approaches.

Select File > Preferences > Keyboard > Shortcuts, and then adjust preference options as described in the table below.

For step-by-step instructions, see Customize Keyboard Shortcuts.

PreferenceUsage
Active settings

Select or import a set of predefined keyboard shortcuts.

For details, see Choose a Set of Keyboard Shortcuts and Use Keyboard Shortcuts Settings Files Created on Other Systems.

Select any one of these options:

Search by action name or shortcut

Search the list of displayed actions.

Shortcuts for <action-name>

View the keyboard shortcut assigned to a selected action.

Add or delete a keyboard shortcut to a selected action.

For details, see,Examples of Creating, Modifying, and Deleting Keyboard Shortcuts.

All possible conflicts

Display conflicts when two or more different actions have the same shortcut.

For details, see Evaluate and Resolve Keyboard Shortcut Conflicts.

Remove the keyboard shortcut from the selection in the All possible conflicts list.

For details, see Evaluate and Resolve Keyboard Shortcut Conflicts.

Fonts Preferences

You an set and specify different fonts for desktop tools.

Select File > Preferences > Fonts, and then set options as described in the table below.

For step-by-step instructions on setting these preferences, see Fonts.

PreferenceUsage

Desktop code font

Specify the font (type, style, and size in points) for tools assigned to use the desktop code font.

To change the list of tools that use the desktop code font, see Fonts Custom Preferences.

Desktop text font

Specify the font (type, style, and size in points) for tools assigned to use the desktop text font.

To have the desktop text font use the same font as your system, select Use system font. Otherwise, clear Use system font and specify the type, style, and size in points in the fields provided. To change the list of tools that use the desktop text font, see Fonts Custom Preferences.

Custom fonts

See which tools currently do not use the desktop text font or the desktop code font. By default, HTML proportional text uses a custom font.

Use antialiasing to smooth desktop fonts

Linux[a] and UNIX[b] platforms only.

Give the desktop a smoother appearance.

This option is not provided on Microsoft Windows or Apple Macintosh platforms, because MATLAB follows the operating system's font settings on these platforms.

[a] Linux is a registered trademark of Linus Torvalds.

[b] UNIX is a registered trademark of The Open Group in the United States and other countries.

Fonts Custom Preferences

You can specify the font for HTML Proportional Text, and to override font settings for individual desktop tools, as described in the table that follows. Desktop tools otherwise use the settings that the Fonts Preferences specify.

Select File > Preferences > Fonts > Custom, and then set options as described in the table below.

For step-by-step instructions on setting these preferences, see Fonts.

PreferenceUsage
Desktop tools

Select HTML Proportional Text or the desktop tool for which you want to view or customize fonts.

Font to useIndicates the font currently being used in the selected desktop tool. Use one of these fonts to change it.
  • Desktop code

    Uses the characteristics of the desktop code font, as described in Fonts Preferences.

  • Desktop text

    Uses the characteristics of the desktop text font, as described in Fonts Preferences.

  • Custom

    Uses the type, style, and size you specify in the fields.

If you change the font style (for example, to bold or italic) for HTML Proportional Text, it has no effect. However, if you change the font size HTML Proportional Text, it affects both code and text for tools using the HTML Proportional Text font.

Colors Preferences

You can specify the text and background color for desktop tools, as well as colors for highlighting syntax elements of MATLAB code.

Select File > Preferences > Colors, and then set options as described in the table below.

PreferenceUsage
Desktop tool colors

Specify that desktop tools use the same text and background colors that your platform uses for other applications by selecting Use system colors..

Customize colors by clearing Use system colors, and then choose Text and Background colors from the drop-down menus .

These colors do not apply to the Help display pane, nor to the Web Browser.

For details, see Changing Text, Background, and Hyperlink Colors in Desktop Tools.

MATLAB syntax highlighting colors

Set colors to help you quickly identify elements of MATLAB syntax in the Editor, Command Window, Command History window, and the MATLAB shortcuts callback area.

For details, see Changing Syntax Highlighting Colors.

MATLAB Command Window colors

Set colors to help you quickly identify errors, warnings, and hyperlinks in the Command Window.

Colors Programming Tools Preferences

You can specify options used for editing and debugging code, including code analysis colors, variable and function colors, and cell display options.

Select File > Preferences > Colors > Programming, and then set options as described in the table below.

PreferenceUsage
Code analyzer colors
  • Warnings—Specifies the color Code Analyzer uses to identify code in the Editor for which there are warning messages.

  • Autofix highlight—Specifies the color Code Analyzer uses to identify code in the Editor for which there is an automatic fix.

For details, see, Automatically Check Code in the Editor — Code Analyzer.

Variable and function colors

Cell display options

Highlight cells—Specifies the color the Editor uses to shade code cells.

Show lines between cells—Specifies that code cells divisions appear with a gray line between each cell in the Editor. These lines do not appear in the published or printed file.

See also, Evaluate Subsections of Files Using Code Cells.

Toolbars Preferences

You can customize some toolbars in the MATLAB application.

Select File > Preferences > Toolbars, and then set options as described in the table below.

For step-by-step instructions on setting these preferences, see Toolbar Customization.

PreferenceUsage
Toolbar

Select the toolbar you want to customize.

Layout

Rearrange the order of controls in the toolbar by dragging and dropping them to a new location in the Layout.

Controls

Select which buttons appear on the selected toolbar.

Web Preferences

Web preferences enable you to specify Internet connection information to MATLAB.

To set Web preferences, select File > Preferences > Web, and then adjust preference options as described in the table below.

PreferenceUsage
Use a proxy server to connect to the Internet

Provide information that MATLAB needs to access the internet when your network uses a firewall or another method of protection that restricts Internet access.

Proxy host

Specify a value for the Proxy host. For example, 172.16.10.8 or ourproxy. If you do not know the values for your proxy server, ask your system or network administrator for the information.

Proxy port

Specify an integer value for the Proxy port. For example, 22. If you do not know the values for your proxy server, ask your system or network administrator for the information.

Use a proxy with authentication

Specifies that your proxy server requires a user name and password.

Proxy username

Specify the proxy server user name.

Proxy password

Specify the proxy server password.

    Note   MATLAB stores the password without encryption in your matlab.prf file.

Test connection

Ensure that your settings work.

If MATLAB cannot access the Internet, Failed! appears next to the button. Correct the values you entered and try again. If you still cannot connect, try using the values you used when you authenticated your MATLAB license.

System Web browserUNIX[a] platforms only — excluding Macintosh
  • Command—Specifies the system command to open the browser.

    For example, opera, opens the Opera Web browser.

  • Options—Specifies options for the system browser.

    For example, geometry 1064x860 specifies the size of the window for Opera.

[a] UNIX is a registered trademark of The Open Group in the United States and other countries.


[a] Linux is a registered trademark of Linus Torvalds.

[b] UNIX is a registered trademark of The Open Group in the United States and other countries.

[a] UNIX is a registered trademark of The Open Group in the United States and other countries.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS