File Exchange

image thumbnail

MATLAB Snippets

version 1.0.6 (8.58 MB) by Pavel Trnka
Code snippets for the Matlab editor.


Updated 12 Nov 2019

From GitHub

View Version History

View license on GitHub

MATLAB Snippets App adds code snippets to the Matlab editor. Snippets definition uses syntax compatible with the Visual Studio Code and with the Textmate 1.x. The integration to the Matlab editor is loose, the snippets are inserted by a keyboard shortcut (usually <ALT+1>).

See the Github project page for the animated App use examples:

* snippets can contain tabstops with default values (placeholders)
* any tabstop value can be mirrored on multiple locations in the snippet
* variables containing currently selected text, currently edited filename, etc. can be used
* tabstop mirroring and variables can be altered by regular expressions

Cite As

Pavel Trnka (2021). MATLAB Snippets (, GitHub. Retrieved .

Comments and Ratings (14)

per isakson

R2018b, Win10 "Swedish". The choices by up/down arrows in matlab-examples.json / example06 just didn't work. It turned out that adding Swedish keywords to insertSnippet() line 635-640

switch char(keyData.getKeyText(keyData.getKeyCode))
case {'Up','Upp'} % 2020-09-22, poi: Added 'Upp', Swedish for 'Up'
choice = current.tabstopObject.getPreviousChoice();
case {'Down','Nedpil'} % Added 'Nedpil', Swedish for 'DownArrow'
choice = current.tabstopObject.getNextChoice();

made the feature work as advertised. Is translating keywords some kind of practical joke by Ms?

per isakson

Now I added my own json-file.

per isakson

I assume it's possible to add a user defined json-file with snippets definitions. However, so far I failed to add my own json-file. I created the file, added it to the snippets-folder, added the name to the opt.jsonFileNames in insertSnippet/loadOptions() and the finally to insertSnippetOptions.mat. No error messages, just silence. Help!

Josh Philipson

Manoj Baishya

Pavel Roslovets

Chang hsiung

Nikolaus Koopmann

oh my god! this is pure Gold! thank you so much!
i have always dreamt of something like this!

Matthew Raymond

Thank you!

Jaroslav Tabacek

Arthur Roué

Jiri Dostal

Finally a tool that helps to keep a high coding standard almost effortlessly.

Jan Prasek

Pavel Otta

MATLAB Release Compatibility
Created with R2019a
Compatible with R2016a and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!