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 currently on the desktop, you can also click New Shortcut in the Manage section.
In the Label field, enter a name for the shortcut.
For this example, enter my_Shortcut.
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
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.
The shortcut icon and label appear on the toolbar. If you have more shortcuts on the toolbar than the desktop can display concurrently, use the drop-down list to access them all.
To organize and edit shortcuts, on the Shortcuts tab, in the Manage section, click Organize Shortcuts to open the Shortcuts Organizer dialog box.
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.