This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Create Shortcuts to Rerun Commands

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.

  1. 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.

  2. Complete the Shortcut Editor dialog box:

    1. In the Label field, enter a name for the shortcut.

      For this example, enter my_Shortcut.

    2. 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


      If command prompts (>>) appear, MATLAB automatically removes them from the Callback field when you save the shortcut.

    3. 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.

    4. In the Icon field, select an icon.

    5. Select both the Add to quick access toolbar and Show label on quick access toolbar options.

    6. Click Save.

    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.

  3. 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.

Was this topic helpful?