File Exchange

image thumbnail

Shortcut tools

version (17.1 KB) by Richie Cotton
Programmatically manipulate shortcuts.


Updated 01 Oct 2010

View Version History

View License

A set of utilities to programmatically manipulate shortcuts (including toolbar shortcuts and help browser favourites).

AddShortcut adds a shortcut to the specified group, which by default is the toolbar, e.g.

AddShortcut('Tidy', 'close all hidden; clear all; clc;');

RemoveShortcuts removes shortcuts from the
specified group, which by default is the toolbar, e.g.

RemoveShortcuts([], 'How to Add');

GetShortcuts retrieves the details of existing toolbar shortcuts, and GetShortcutCategories retrieves the categories that those shortcuts are stored in.

CopyShortcuts moves shortcuts between categories.

AddBrowserFavourite adds a favourite page/command to your help browser favourites list.

Note that the functions rely on undocumented MATLAB features which are subject to change. The files all work correctly in R2010a, R2009b, R2009a and R2008b, (but note that the icon file given in the example does not exist in R2008b). Previous versions have not been tested.

Cite As

Richie Cotton (2021). Shortcut tools (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Martin Roempert

As shortcuts are obsolete in R2018a and favorites are used now ... is there an equivalent API for favorites?
com.mathworks.mlwidgets.shortcuts.ShortcutUtils is stil available but shortcuts and favorites are not equivalent.


Very useful for R2012 version of MatLab. However, does not work for R2015. Has somebody an idea how to get it to work reliably for R2015?

Ori Adam

very useful. Just the toolbox I was looking for.

Adam Filion

Shlomi Buganim


Excellent set of tools! Thank you very much.

Jesse Hopkins

There is definitely a need for this. Thanks for this submission and the helpful documentation. I was working on similar functionality a while back, and stumbled on the "editShortcut" method of ShortcutUtils, which is nice because it will create a shortcut if it doesn't exist, otherwise will modify the existing shortcut. This way you don't need to blow away the shortcuts everytime. Here's the syntax I've used:
awtinvoke(com.mathworks.mlwidgets.shortcuts.ShortcutUtils,'editShortcut',name,'Toolbar Shortcuts',name,'Toolbar Shortcuts',evalstr,iconfile,'true')

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!