Customize Keyboard Shortcuts
Keyboard shortcuts are useful for accessing desktop features quickly. To optimize your experience, you can customize the current set of keyboard shortcuts in MATLAB®.
There are several ways you can modify the current set of keyboard shortcuts. You can:
Create new keyboard shortcuts or modify existing ones.
Choose among available sets of keyboard shortcuts.
Create customized sets of keyboard shortcuts or use existing customized sets.
To view or modify the current set of keyboard shortcuts, use the Keyboard Shortcuts Preferences options in the Preferences Window. To open the Keyboard Shortcuts Preferences page in the Preferences Window, go to the Home tab, and in the Environment section, click Preferences. Then, select MATLAB > Keyboard > Shortcuts.
View Keyboard Shortcuts
For actions performed with a menu item, keyboard shortcuts appear in the menu itself. This is true whether the menu item is in the toolstrip or in a context menu. If a menu item does not display a keyboard shortcut, then a keyboard shortcut for the action does not exist.
For actions that are not performed with a menu item, to find keyboard shortcuts,
open the Keyboard Shortcuts Preferences page in the Preferences
Window. Then, in the search box, enter the name of the tool or action for which you
want to see the keyboard shortcuts. For example, type Editor
clear
to find the keyboard shortcut for clearing selected text in
the Editor.
To view the shortcuts for an action, select the action name. For example, select Clear Selection. MATLAB displays the keyboard shortcuts for the selected action. For example, the keyboard shortcut for the Clear Selection action in the Editor is the Escape key.
Create a List of All Keyboard Shortcuts in a Set
You can create a list of all the keyboard shortcuts in the current set by
copying them to the clipboard and pasting them in a text file or spreadsheet
application, such as Microsoft®
Excel®. For the best formatting, use a spreadsheet application. To copy
all the keyboard shortcuts, open the Keyboard Shortcuts
Preferences page in the Preferences Window. Click the Actions
button and from the drop-down menu, choose
Copy to Clipboard
. Paste the data into the
desired application.
Customize Keyboard Shortcuts for Individual Actions
Customizing a keyboard shortcut is useful if you frequently perform an action and the action does not have a keyboard shortcut defined, or if the defined keyboard shortcut is hard to use or conflicts with a different shortcut. For an overview on customizing keyboard shortcuts, watch the Customizable Keyboard Shortcuts video. You must have an internet connection to watch the video.
To customize a keyboard shortcut:
Open the Keyboard Shortcuts Preferences page in the Preferences Window and, in the search box, type an existing keyboard shortcut or the name of an action, tool, or menu.
For example, you can type
Ctrl+R
(shortcut),Delete
(action),Command Window
(tool), orFile
(menu).You can enter most keyboard shortcuts by either pressing keystrokes or typing the key names. If using keystrokes for a keyboard shortcut does not work, try typing the key names instead. For example, if pressing the Ctrl key and then R does not work, try typing the text
Ctrl+R
.MATLAB displays the list of matching actions for which you can customize or define a keyboard shortcut. If you specify the name of a tool, MATLAB displays actions associated with the tool or menu, as well as any action names that contain the specified text.
Select the name of the action for which you want to define or modify a keyboard shortcut.
Click the Add button .
An editable text box opens in the Shortcut column.
Specify the keystrokes you want to use for the keyboard shortcut.
A keystroke can be a single key or the combination of a modifier (Alt, Shift, or Ctrl) and another key. Specify a keystroke by performing it, not by typing the names of the keys character by character. For example, press the Ctrl key and the Y key. Do not type C-t-r-l-+-Y.
Alternatively, you can choose a shortcut from the drop-down menu.
To specify multiple keystrokes for one action, or to limit the number of keystrokes for an action, click the down arrow next to the key icon in the Shortcuts box. Then, select either
Limit to 1 keystroke
,Limit to 2 keystrokes
, orLimit to 3 keystrokes
. For example, to specify Ctrl+Y, Shift+Z, F9 as the three keystrokes for an action, selectLimit to 3 keystrokes
and then type the keystrokes.In the Tools with shortcut column, click the down arrow and select which tools you want to assign the keyboard shortcut to.
Evaluate and resolve any conflicts, indicated by the error icon and informational icon . The error icon indicates that two different actions within the same tool have the same shortcut. The informational icon indicates that two different actions in two different tools have the same shortcut.
There is no requirement to resolve keyboard shortcut conflicts. However, if the same shortcut specifies two different actions, the shortcuts can be confusing to use. Resolving all conflicts indicated by the error icon is recommended, although in some situations, resolving a conflict might be unnecessary. For example, resolving the conflict might be unnecessary if the conflict is temporary or the two actions are associated with different modes of the same tool. Resolving conflicts indicated by the informational icon is recommended if you use both tools frequently and you perform both actions frequently.
To resolve a conflict, change or delete shortcuts such that there is a one-to-one correspondence between shortcuts and frequently used actions.
Click OK or Apply.
New or modified keyboard shortcuts become available immediately. Changed shortcuts that correspond to menu items immediately appear in the menu.
To delete a keyboard shortcut for a selected action, select the keyboard shortcut that you want to delete and click the Delete button .
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, click the Actions button and select Undo Modifications to
<Set Name>
Default Set
(modified), where <Set Name>
is
the name of the modified default set.
Note
Undoing modifications reverts all keyboard shortcuts changes that you made to the set. You cannot undo modifications on a shortcut-by-shortcut basis.
Restrictions When Customizing Keyboard Shortcuts
There are some actions and tools for which you cannot change the keyboard shortcuts. Actions for which the keyboard shortcut cannot be customized do not appear when you search for them in the Keyboard Shortcuts Preferences page in the Preferences Window. Examples of these actions include canceling the current action (Esc), interrupting MATLAB execution (Ctrl+C), and some of the navigational actions described in Use Keyboard Shortcuts to Navigate MATLAB.
In addition, you cannot change the keyboard shortcuts associated with these tools or portions of tools:
Figure windows — For example, you cannot modify the keyboard shortcut, Ctrl+S, for saving a MATLAB
.fig
file.Toolboxes — For example, you cannot modify keyboard shortcuts in the SimBiology® desktop.
Incremental search — You can modify the keyboard shortcuts for initiating a forward or backward incremental search. However, you cannot change the keyboard shortcuts that you use within incremental search mode, such as Ctrl+Shift+S to search forward.
Dialog boxes — For example, you cannot create a keyboard shortcut for the OK button.
Manage Sets of Keyboard Shortcuts
Select Set of Keyboard Shortcuts
By default, MATLAB uses the keyboard shortcut settings for your current platform. To
select a different set of keyboard shortcuts, open the Keyboard
Shortcuts Preferences page in the Preferences Window and, in
Active settings, select from the available options. To
use a keyboard shortcut settings file that is on your system but not in the
Active settings list, select
Browse...
to find and select the desired
file.
This table lists the keyboard shortcut settings files installed with MATLAB.
Operating System | Keyboard Shortcut Settings Files Installed with MATLAB |
---|---|
Windows® |
|
Linux® |
|
macOS |
|
You also can download keyboard shortcut settings files from File Exchange. For
example, to restore the MATLAB default keyboard shortcuts that were in place for MATLAB Version 7.9 (R2009a) and earlier releases, go to File
Exchange and search for MATLAB Desktop R2009a Default Keyboard Shortcut sets
.
Download and extract the set and then select it as the active settings file. A
valid keyboard shortcut settings file appears with a keyboard key icon
.
Compare Sets of Keyboard Shortcuts
To compare the current set of keyboard shortcuts to another set:
Open the Keyboard Shortcuts Preferences page in the Preferences Window and click the Actions button .
From the drop-down menu, choose the set of keyboard shortcuts to which you want to compare the current set.
The Comparison Tool opens and displays the two keyboard shortcut sets side-by-side. For more information about how to read the results, see Compare Text Files.
Save Set of Keyboard Shortcuts to File
Saving a set of keyboard shortcuts to a settings file is useful if you want to:
Save the changes you make to a default keyboard shortcut set to a new set.
Use a set of customized keyboard shortcuts on another system running MATLAB.
Overwrite a previously saved set of keyboard shortcuts.
Share a set of keyboard shortcuts with others, for example, on File Exchange.
To save a keyboard shortcut settings file, open the
Keyboard Shortcuts Preferences page in the Preferences
Window. Then, click the Actions button and select Save
As
. MATLAB saves the file as an .xml
file in the folder
that you specify.
You cannot overwrite the default settings files that install with MATLAB. MATLAB saves modifications that you make to a default set using the name
of the default set appended with the text (modified)
, for
instance, Windows default (modified)
.
Delete Set of Keyboard Shortcuts
To delete a previously saved set of keyboard shortcuts, open the
Keyboard Shortcuts Preferences page in the Preferences
Window and in Active settings, select the set of keyboard
shortcuts that you want to delete. Click the Actions button
and select Delete
, where
filename
filename
is the name of a keyboard shortcut set
you want to delete. You cannot delete default keyboard shortcut sets, such as
Windows Default Set
.