Skip to Main Content Skip to Search
Product Documentation

Keyboard Shortcuts

Keyboard Shortcuts

A keyboard shortcut is a means of using keyboard key strokes to perform a desktop action, without opening a desktop menu. If a keyboard shortcut is assigned to an action, it appears next to that action on the menu and as a tooltip for that action on the toolbar. For example, the default keyboard shortcut for opening a file is Ctrl+O.

A tooltip for the action also appears on the Editor toolbar.

An action can have multiple keyboard shortcuts. All defined shortcuts work, but only one appears on the desktop menu and as a toolbar tooltip.

You can:

Performing Desktop Actions Using the Keyboard

Keyboard Key Combinations.  As an alternative to using the mouse, you can press a combination of keyboard keys to perform some desktop actions. MATLAB supports the use of both mnemonics and keyboard shortcuts.

What Is a Mnemonic?.  

A mnemonic is a means of using keystrokes to perform a desktop action. For instance, clicking a button or opening a menu, and then choosing an option. It is called a mnemonic because it frequently uses the first letter of the menu or menu option name. This convention helps you to remember the keystrokes required to use the mnemonic.

Mnemonics appear as underlined letters on menus or buttons. For instance, the F in the MATLAB File menu appears as shown in the following image.

Using Mnemonics.  

To open a menu or activate a button using mnemonics, press the Alt key and the letter key indicated by the underlined letter in the menu name, menu option name, or button name. The action occurs when you press the letter. You also can use mnemonics to perform an action that would require multiple mouse clicks. For example, opening the print dialog box: Alt+F, P.

Customized keyboard shortcuts can override mnemonics. For example, if you specify Alt+F, P as the keyboard shortcut for the Delete action across the desktop, then pressing Alt+F, P no longer opens the Print dialog box. You cannot customize mnemonics.

Platform Differences.  

What Is a Keyboard Shortcut?.  

A keyboard shortcut is a means of using keyboard key strokes to perform a desktop action, without opening a desktop menu. For example, the default keyboard shortcut for opening a file is Ctrl+O. See Keyboard Shortcuts for more information.

If you define a keyboard shortcut that uses the same keystrokes as a mnemonic, but performs a different action, then the mnemonic no longer works.

Examples of Mnemonics and a Keyboard Shortcut.  

The image that follows shows the desktop File menu. Notice the mnemonic and keyboard shortcut for closing the Command Window.

Choose a Set of Keyboard Shortcuts

By default, MATLAB uses keyboard shortcut settings that correspond to the platform on which you are running. To choose different keyboard shortcut settings, follow these steps:

  1. Open the Keyboard Shortcuts Preferences dialog box by choosing File > Preferences > Keyboard > Shortcuts.

  2. Click the down arrow in the Active settings field, and make a selection from the drop-down list, as summarized in this table.

    Settings File Option to SelectDetails

    Installed with MATLAB

    • On Mac®, Mac Default Set

    • On all other systems, Windows Default Set or Emacs Default Set

    For a description of the files that install with MATLAB, see Installed Settings Files for Keyboard Shortcuts

    Previously added

    The file name

    No additional information.

    On your system, but not in the drop-down list

    Browse

    Browse to Keyboard Shortcuts Settings Files

    Created by someone else and uploaded to File Exchange

    Search File Exchange for Downloadable Shortcut Sets

    Download Keyboard Shortcut Settings Files from File Exchange .

    MATLAB keyboard shortcuts available in Version 7.9 (R2009a) and earlier releases

    Search File Exchange for Downloadable Shortcut Sets

    Download Keyboard Shortcut Settings Files from File Exchange .

  3. Click Apply.

Installed Settings Files for Keyboard Shortcuts

The following table lists the keyboard shortcuts settings files installed with MATLAB.

Operating SystemKeyboard Shortcut Settings Files Installed with MATLAB
Windows
  • Windows Default Set (Default)

  • Emacs Default Set

UNIX
  • Emacs Default Set (Default)

  • Windows Default Set

Macintosh
  • Macintosh Default Set (Default)

Browse to Keyboard Shortcuts Settings Files

Browse to use a keyboard shortcuts settings file that is on your system, but not an Active settings choice in the Keyboard Shortcuts Preferences dialog box. This situation typically arises when you copy a settings file from another system to a folder other than the prefdir directory. To browse to a settings file and make it your active settings file, follow these steps:

  1. Choose File > Preferences > Keyboard > Shortcuts.

  2. In the Active settings field, click the down arrow, and then select Browse.

  3. In the Open dialog box, navigate to the folder containing the settings file.

  4. Select the settings file, and then click Open.

  5. In the Keyboard Shortcuts preferences pane, click OK.

    The settings file you selected in step 4 is now the active settings file for MATLAB.

Future MATLAB sessions will provide this settings file as a choice in the Active settings drop-down menu.

Download Keyboard Shortcut Settings Files from File Exchange

Download keyboard shortcut settings files from File Exchange when you want to do either of the following:

Follow these steps:

  1. Choose File > Preferences > Keyboard > Shortcuts.

  2. In the Active settings field, click the down arrow, and then select Search File Exchange for Downloadable Shortcut Sets.

    MATLAB opens File Exchange.

  3. Enter your MathWorks account information, and then click Submit.

    If you do not have a MathWorks account, create one by clicking Create an account, and then completing the form that opens in your Web browser.

  4. Search File Exchange for the keyboard shortcut set that you want to use.

    When you follow the steps presented so far, File Exchange lists all files tagged with keyboard shortcuts configurable including:

    • MATLAB Desktop R2009a Non-Default Keyboard Shortcut sets

    • MATLAB Desktop R2009a Default Keyboard Shortcut sets

    For a description, click the file name in the File Summary column of File Exchange. Click the Back button to return to the list of files.

  5. Click the download button next to the file you want to download.

  6. Respond to the Download MATLAB Desktop confirmation dialog boxes as follows:

    1. Click Download.

    2. Click Change Current Folder to Download Location.

    The downloaded .ZIP file appears in the Current Folder Browser. Expand it to preview its contents.

  7. In the Current Folder browser, right-click the downloaded .ZIP file, and then select Extract.

    MATLAB creates a subfolder with the same name as the .ZIP file and extracts the files from that .ZIP file into the newly created folder.

  8. In the Current Folder browser, expand the newly created folder, and then double-click the settings file you want to use.

    A keyboard key icon preceding a file name indicates a valid keyboard shortcut settings file.

  9. In the Keyboard Shortcuts Preferences dialog box, review the settings, and then click OK.

The newly downloaded settings file is now in effect.

Compare Sets of Keyboard Shortcuts

Compare sets of keyboard shortcuts to:

Steps for Comparing Keyboard Shortcuts

To compare your current set of keyboard shortcuts to another set:

  1. Choose File > Preferences > Keyboard > Shortcuts.

  2. Click the Actions button .

  3. From the drop-down menu, choose the set of keyboard shortcuts to which you want to compare the current set.

  4. The Comparison Tool opens and displays the two keyboard shortcut sets side-by-side.

Read the Results of Comparing Sets of Keyboard Shortcuts

When you compare keyboard shortcut sets, they appear in the Comparison Tool as follows:

See also Using Comparison Tool Features.

Display Keyboard Shortcuts

The following sections describe the various ways you can display keyboard shortcuts:

List All Keyboard Shortcuts in a Set

You can copy all the keyboard shortcuts from a keyboard shortcuts set and paste them in a text file or spreadsheet application, such as Microsoft Excel®. To create a list of keyboard shortcuts for easy browsing and future reference, follow these steps:

  1. Choose File > Preferences > Keyboard > Shortcuts.

  2. Click the Actions button .

  3. From the drop-down menu, choose Copy to Clipboard.

  4. Open a spreadsheet application or a text editor.

    For the best formatting use a spreadsheet application.

  5. Paste in the data from the clipboard.

    In Microsoft Excel, for example, choose Home > Paste.

Display Keyboard Shortcuts on Menus

Open the menu to see if the keyboard shortcut appears next to the menu option.

For example, suppose you want to determine the keyboard shortcut for decreasing the indent in the Editor. Open the Text menu, and then view the keyboard shortcut for Decrease Indent. The keyboard shortcut Ctrl+[ appears to the right of the option.

If no keyboard shortcut appears on the menu, one does not currently exist for that action. To create a keyboard shortcut for an action, follow the steps in Customize Keyboard Shortcuts.

Display Keyboard Shortcuts in the Preferences Dialog Box

To identify a keyboard shortcut when there is no menu option for an action, use the Keyboard Shortcuts Preferences pane:

  1. Choose File > Preferences > Keyboard > Shortcuts.

  2. In the filter field, type the name of the tool for which you want to list the keyboard shortcuts. For example, type Editor to see the keyboard shortcuts currently defined for actions you can perform in the Editor.

  3. Narrow the list of Action names that the preferences pane displays by adding a string describing the action. For example, add clear, if you want to find the keyboard shortcut for clearing selected text in the Editor. Type a short string to increase the likelihood of the filter returning the action you seek.

  4. Select the action name of interest. In this example, select Clear Selection.

  5. View the table labeled Shortcuts for Clear Selection. It indicates that the Escape key is the current keyboard shortcut for the Clear Selection action in the Editor.

Customize Keyboard Shortcuts

To customize or view keyboard shortcuts for MATLAB desktop tools, choose File > Preferences > Keyboard > Shortcuts. If you have an active Internet connection, you can watch the Customizable Keyboard Shortcuts video for an overview.

The following sections provide details:

Consider using File Exchange to share your active settings file with others. For more information, see Submitting Your Files to the Repository.

Steps for Customizing Keyboard Shortcuts

  1. Choose File > Preferences > Keyboard > Shortcuts.

  2. In the Active settings field, choose the file that contains the set of keyboard shortcuts that you want to customize.

    Typically, the first time you modify keyboard shortcuts, you begin with the default settings for your platform. For details, see Choose a Set of Keyboard Shortcuts.

  3. Under Action name, select the action for which you want to define or modify a keyboard shortcut. An action is the operation for which you want to customize the shortcut, such as Clear Command History.

    For tips on finding the action you want, see Filter Keyboard Shortcut Actions.

  4. Click the Add button .

    An editable field opens under the Shortcut column.

  5. Type the shortcut that you want to use for the action you selected in Step 3. Alternatively, you can choose a shortcut from the drop-down menu.

    For details, see Specify Keystrokes for a Keyboard Shortcut.

  6. Assign the shortcut to the tool or tools with which you want to use it. For example, in the Tools with shortcut column:

    1. Click the down arrow for the list of desktop tools to which you can assign a shortcut. Not all actions are available with all desktop tools.

    2. Select a check box to assign the shortcut to a tool. Clear a check box to remove it.

  7. Evaluate and resolve any conflicts, indicated by the informational and error icons.

    For more information, see Evaluate and Resolve Keyboard Shortcut Conflicts.

  8. Click Apply.

    • The keyboard shortcut becomes available immediately.

    • If a changed shortcut corresponds to a menu option that previously displayed no keyboard shortcut, MATLAB reflects the new keyboard shortcut on the menu.

Restore Default Keyboard Shortcut Sets

If you modify keyboard shortcuts, and then decide you do not want to keep the changes, you can restore the default shortcuts. To restore the default state of a keyboard shortcut:

  1. Click the Actions button .

  2. Select Undo Modifications to Windows Default Set (modified) or Undo Modifications to Emacs Default Set (modified), as appropriate for your system.

  3. Click OK.

Save Keyboard Shortcuts to a Settings File

Save keyboard shortcuts to a settings file to:

To save a keyboard shortcuts settings file, follow these steps:

  1. Open the Keyboard Shortcuts Preferences dialog box by choosing File > Preferences > Keyboard > Shortcuts.

  2. Click the Actions button , and then select Save As.

  3. In the Save dialog box, navigate to the folder where you want to save the file, specify the file name, and then click Save.

    MATLAB saves the file as an .xml file in the folder that you specified.

Filter Keyboard Shortcut Actions

Use the filter field to see the list of actions for which you can customize or define a keyboard shortcut:

  1. Type all or part of any one of the following:

    • An action name, for example, Delete.

      MATLAB displays only the action names or desktop menus that contain the text you specify.

    • The name of a desktop tool or menu, for example, File or Command Window.

      MATLAB displays a list of the action names associated with the tool or menu you specify. In addition, the list includes any action names that contain the name of the tool or menu. For example, if you specify Command History, the list of action names includes Next History Command, which is a Command Window action.

    • A keyboard shortcut, for example, Ctrl+R

      MATLAB displays only the action names that have the shortcut you specify. Be aware of the following:

      • You can enter most keyboard shortcuts by either pressing keystrokes or typing the key names.

        For example, to enter Ctrl+S, use the keystroke (by pressing the Ctrl key and the S key). Or, type Ctrl+S character by character (C-t-r-l-+-Y).

      • If using keystrokes for a keyboard shortcut does not work, try typing the characters instead. You must type some keyboard shortcuts character by character, such as shortcuts including the Tab, Backspace, or Delete keys.

      • Type numpad to refer to the number pad that is on the far right of some keyboards.

      • Type Up or Down to refer to the Up arrow or Down arrow keypad keys, respectively.

  2. Verify that an Action name performs the action you expect:

    1. Hover the mouse pointer over the Action name. For example, Remove Next Word.

    2. View the tooltip that appears.

Specify Keystrokes for a Keyboard Shortcut

A keystroke can be a single key or the combination of a modifier (Alt, Shift, or Ctrl) and another key. When you create a keyboard shortcut, specify the keystrokes for the shortcut as follows:

  1. Click the Add button .

  2. Specify the number of keystrokes you want to use for the shortcut:

    • To use the default number of keystrokes, which is one keystroke, skip to step 3.

    • To specify multiple keystrokes, or to specify explicitly one keystroke follow these steps:

      1. Click the down arrow next to the key icon in the Shortcuts field.

      2. Choose Limit to 1 keystroke, Limit to 2 keystrokes, or Limit to 3 keystrokes.

        For instance, Ctrl+F is one keystroke, Ctrl+Y, Shift+Z is two keystrokes, and Ctrl+Y, Shift+Z, F9 is three keystrokes.

  3. Specify the keystrokes by doing one of the following:

    • Type the keystrokes, by pressing the keys, not by typing the key names character by character.

      For example, press the Ctrl key and the Y key. Do not type C-t-r-l-+-Y.

    • Choose a keystroke, such as the Tab key, by clicking the down arrow next to the key icon in the Shortcuts field. Then, choose the key name.

      The listed keys already have a defined action within dialog boxes. For example, the Tab key navigates from one field to the next in dialog boxes.

Evaluate and Resolve Keyboard Shortcut Conflicts

Conflicts arise when two or more different actions have the same shortcut. There is no requirement that you resolve keyboard shortcut conflicts. However, if the same shortcut specifies two different actions, the shortcuts can be confusing to use.

View keyboard shortcut conflicts by choosing File > Preferences > Keyboard > Shortcuts.

The Keyboard Shortcuts preferences pane indicates conflicts using informational and error icons.

Actions in Different Tools Have the Same Shortcut — Evaluating Conflicts

Typically, you want to resolve conflicts indicated by the informational icon when all the following are true:

For instance on Microsoft Windows platforms, by default, Ctrl+Shift+U undocks a tool from the MATLAB desktop. However if you select text in the Editor, and then press Ctrl+Shift+U, it changes the selected text to uppercase. If you frequently use both of these actions, you can specify a different keyboard shortcut for one or both actions.

Actions in the Same Tool Have the Same Shortcut — Evaluating Conflicts

Typically, you want to resolve conflicts indicated by the error icon .

It can be unnecessary to resolve these conflicts if one or more of the following are true:

Resolve Keyboard Shortcut Conflicts

To resolve a conflict, change or delete shortcuts such that there is a one-to-one correspondence between a shortcut and a frequently used action. For examples, see Changing a Keyboard Shortcut and Deleting a Keyboard Shortcut.

Examples of Creating, Modifying, and Deleting Keyboard Shortcuts

Creating a New Keyboard Shortcut

By default, no keyboard shortcut is available for adding a Help topic to the list of favorites. If you frequently mark topics as favorites, you can define a keyboard shortcut for this action, as follows:

  1. Choose File > Preferences > Keyboard > Shortcuts.

  2. In the filter field, type Help.

  3. Scroll through the Action name list, and select Add to Favorites.

  4. Click the plus button

    MATLAB adds a row to the table above the plus button.

  5. In the Shortcut field, click the down arrow, and then change Limit to 1 keystroke to Limit to 2 keystrokes.

  6. In the Shortcut field, press Ctrl+S, and then Alt+V.

    Notice that the All possible conflicts table is empty, which indicates that no other desktop action is currently using this combination of keystrokes.

  7. Click Apply.

Notice that:

Changing a Keyboard Shortcut

Suppose you frequently adjust indenting in the MATLAB Editor. However, you have difficulty remembering the default keyboard shortcut of Ctrl+[ for decreasing the indent. So, you decide to change it to something that is easier to remember.

This example changes the keyboard shortcut for Decrease Indent in the MATLAB Editor from Ctrl+[ to Ctrl+Backspace:.

  1. Choose File > Preferences > Keyboard > Shortcuts.

  2. Under Active settings, choose Windows Default Set.

  3. In the filter field, press Ctrl+[.

  4. Under Action name, select Decrease Indent.

  5. In the table labeled Shortcuts for Decrease Indent, under Shortcut, click Ctrl+[. MATLAB makes the field editable.

  6. In the Shortcut field, press Ctrl+Backspace twice.

    The first time you press the key combination, it deletes Ctrl+[. The second time you press it, Ctrl+Backspace appears in the field.

  7. Click Apply.

    MATLAB saves your changes to the Windows Default Set (modified) settings.

Deleting a Keyboard Shortcut

Suppose you find yourself frequently pressing the wrong keyboard shortcut. For example, on Windows, you press Alt+Enter (to apply a code analyzer autofix) instead of Ctrl+Enter (to evaluate the current cell in the MATLAB Editor ). To avoid accidentally applying an autofix, delete the Alt+Enter shortcut by following these steps:

  1. Choose File > Preferences > Keyboard > Shortcuts.

  2. Under Active settings, choose Windows Default Set or Windows Default Set (modified).

  3. In the filter field, press Alt+Enter.

  4. Under Action name, select the row containing Autofix Message.

  5. In the next table, under Shortcuts for Autofix Message, select the row containing Alt+Enter.

  6. Click the remove button .

  7. Click Apply.

    If it does not exist, MATLAB creates a Windows Default Set (modified) keyboard shortcut set. This set consists of the Windows Default Set of keyboard shortcuts, less the shortcut for Alt+Enter. If the Windows Default Set (modified) settings file exists, then MATLAB deletes the Alt+Enter keyboard shortcut from that set of keyboard shortcuts.

See also Delete a Set of Keyboard Shortcuts.

Delete a Set of Keyboard Shortcuts

If you previously saved or copied a set of keyboard shortcuts to your system and you no longer want it, delete it as follows:

  1. Choose File > Preferences > Keyboard > Shortcuts.

  2. Under Active settings, choose the set of keyboard shortcuts that you want to delete.

    You cannot delete default keyboard shortcut sets, such as Windows Default Set.

  3. Click the Actions button and choose Delete filename, where filename is the name of a keyboard shortcut set you previously saved or copied to your system.

For information on deleting a single keyboard shortcut from a set that you want to keep, see Deleting a Keyboard Shortcut.

Use Keyboard Shortcuts Settings Files Created on Other Systems

If you find a keyboard shortcuts settings file that is useful to you, or if you want to use one you created on a different system, make it the active settings file as follows:

  1. Copy the settings file to a folder on your system, such as:

    I:\my_matlab_files\active_settings_files\new_settings.xml
  2. Choose File > Preferences > Keyboard > Shortcuts.

  3. In the Active settings field, click the down arrow, and then click Browse.

  4. In the Open dialog box, navigate to the folder where you copied the settings file.

  5. Select the settings file, and then click Open.

  6. In the Keyboard Shortcuts preferences pane, click Apply. The settings file you specified is now the active settings file for MATLAB.

Consider using File Exchange to share your active settings file with others, or to find a file that is useful to you. For more information, see Submitting Your Files to the Repository and Get Files from the File Exchange Repository.

Keyboard Shortcut Restrictions

These sections describe the tools, portions of tools, and actions for which you cannot change keyboard shortcuts:

Tools for Which You Cannot Customize Keyboard Shortcuts

You cannot change the keyboard shortcuts associated with the following tools or portions of tools:

Actions for Which You Cannot Customize Keyboard Shortcuts

The following table describes some frequently used actions for which you cannot customize keyboard shortcuts.

Action

Keyboard Shortcut

Cancel the current action.

Esc (escape)

For example, if you select the Edit menu, the menu items display. Pressing Esc retracts the menu items.

In the Function Browser, pressing Esc up to three times has the following effects:

  1. Dismisses the search history

  2. Clears the search field

  3. Closes the Function Browser

Interrupt MATLAB execution on all supported platforms.

Ctrl+C

Interrupt MATLAB execution on Windows and UNIX systems.

Ctrl+Cancel

Interrupt MATLAB execution on Macintosh systems.

Cmd+. (period)

Open context menu on Windows and UNIX systems.

Ctrl+Shift+F10

Close the desktop and consequently shut down the MATLAB program. Outside the desktop, close the active window (except on Macintosh platforms).

Alt+F4

Accessibility affordances

Tab for navigating through fields in dialog boxes, for example.

Make an open tool the active tool

These shortcuts appear on the desktop Windows menu:
  • Command Window: Ctrl+0

  • Command History: Ctrl+1

  • Current Folder: Ctrl+2

  • Editor: Ctrl+Shift+0

  • Figures: Ctrl+Shift+1

  • Figure Palette: Ctrl+7

  • Comparison Tool: Ctrl+Shift+4

  • File Exchange: Ctrl+6

  • Help: Ctrl+4

  • Plot Browser: Ctrl+8

  • Profiler: Ctrl+5

  • Variable Editor: Ctrl+Shift+3

  • Web Browser: Ctrl+Shift+2

  • Workspace: Ctrl+3

  


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