This example shows how to create, run, edit, and organize MATLAB® shortcuts. A MATLAB shortcut is an easy way to run a group of MATLAB language statements that you use regularly. For example, use a shortcut to set up your environment when you start working, or to set the same properties for figures you create.
On the Home tab, click New, and then select Command Shortcut.
If the Shortcuts tab is on the desktop, you can also click New Shortcut in the Manage section.
Complete the Shortcut Editor dialog box:
In the Label field, enter a name for the shortcut.
For this example, enter
In the Callback field, type statements you want the shortcut to run.
You also can drag and drop statements from the Command Window, Command History Window, or a file.
For this example, enter these statements:
format compact clear workspace filebrowser clc
If command prompts (
In the Category field, type the name of a new category or select an existing category from the drop-down list. If you leave this field blank, the shortcut appears in the General section of the toolbar.
In the Icon field, select an icon.
Select both the Add to quick access toolbar and Show label on quick access toolbar options.
The shortcut icon and label appear on the quick access toolbar. If the shortcut icon does not appear on the quick access toolbar, use the drop-down to see the full list.
To organize and edit shortcuts, on the Shortcuts tab, in the Manage section, click Organize Shortcuts to open the Shortcuts Organizer dialog box. If the Shortcuts tab is not visible, go to the Home tab, and in the Environment section, click Layout. Then, under Show, select Shortcuts Tab.
Run a shortcut by clicking its icon on the Shortcuts tab.
All the statements in the shortcut Callback field execute as if you ran those statements from the Command Window, although they do not appear in the Command History window.