MATLAB Community

MATLAB, community & more

Shortcuts for commonly used code

If you haven’t discovered Shortcuts yet, you should. Shortcuts are useful for storing small snippets of m-code that you regularly run. If you find yourself typing the same 3 or 4 lines of code everyday, you should select those lines in the Command History (or the Command Window) and drag them up to the Shortcuts Toolbar in the Desktop. This will automatically create a shortcut on the toolbar.


A dialog will open where you can modify the code, give it a catchy name, and even change the icon.


The shortcut shows on the Shortcuts Toolbar.


Shortcuts also show in the MATLAB Start Button. In the Shortcuts menu in the Start Button, you will find all of your Shortcuts including the Toolbar Shortcuts and any Help browser favorites you may have bookmarked. In this area, you can create more categories of shortcuts for even greater storage capacity and organization.


When your shortcuts start getting a little disorganized, you can open the Shortcuts Organizer from the Shortcuts Toolbar context menu or the Start Button Shortcuts menu. In this dialog, you can move items up and down and into categories, rename items, create new categories, and delete items.


So, if you haven’t already, give Shortcuts a try. It is as easy as drag and drop.

Do you have a favorite Shortcut? We’d love to hear what it is.

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.