Desktop Tools and Development Environment |
|
Creating Shortcuts
This is an example of a shortcut you might create for a project you work on, the Sea Temperature project. When you work on that project, you might want to set up your environment in a certain way by running a series of statements. You create a shortcut called sea_temp_env
, which contains the statements. Then when you work on the project, you run the shortcut to execute all of the statements with a single click. The statements are
more on
format long e
cd d:/mymfiles/sea_temp_project
clear
workspace
filebrowser
clc
To create a shortcut, perform the following steps:
- From the Start button, select Shortcuts -> New Shortcut.
- The Shortcut Editor dialog box appears.
- Create the shortcut by completing the dialog box, as shown in the following illustration.
- Provide a shortcut name in the Label field, for example,
sea_temp_environment
.
- Put the environment setup statements in the Callback field as shown in
the following illustration. Either type them in, or copy and paste or drag
them from a desktop tool. Edit the statements as needed. The field uses
the Editor/Debugger preferences for key bindings, colors, and fonts. Note
that if you copy the statements from the Command Window, the prompt
appears in the shortcut, but MATLAB removes the prompt when you
save the shortcut.
- Assign a category, which is like a directory for organizing shortcuts.
Specify
sea_temp_project
. To add the shortcut to the shortcuts toolbar,
select the Toolbar Shortcuts
category.
- Use the default shortcuts icon , or select your own.
- Click Save. MATLAB automatically removes any Command Window
prompts (
>>
) in the Callback field upon saving the shortcuts.
- MATLAB adds the shortcut to the Shortcuts entry in the Start button, and to the Shortcuts toolbar, if you selected that category.
- After creating a shortcut, run it by selecting it from its category in the Start button. You can also run it from the Shortcuts toolbar if you selected the
Toolbar Shortcuts
category.
MATLAB maintains shortcut information in the file shortcuts.xml
. Type prefdir
, and MATLAB displays the location of the file. Most likely, you will not need to access this file, as MATLAB updates the file automatically.
For more information on the options in the Shortcut Editor dialog box, click the Help button.
Additional Ways to Create Shortcuts. You can also use these methods to create shortcuts:
- Add shortcuts to and run them from the desktop Shortcuts toolbar. See Shortcuts Toolbar.
- From the Command History window, create a shortcut by selecting statements, right-clicking, and selecting Create Shortcut from the context menu. By default, shortcuts created from the Command History window are assigned to the
Toolbar
category, meaning they will appear on the Shortcuts toolbar.
- From the Help browser, select Favorites -> Add to Favorites, complete the Favorites Editor dialog box, and the shortcut appears in the shortcuts
Help Browser Favorites
category. You can also access Help Browser Favorites
shortcuts from the Help browser Favorites menu.
- Drag statements from a desktop tool, such as the Command History, onto the Start button.
| Shortcuts for MATLAB--Easily Run a Group of Statements | | Running Shortcuts | |
© 1994-2005 The MathWorks, Inc.