Home Matlab Development in Visual Studio Code
Post
Cancel

Matlab Development in Visual Studio Code

I almost use Matlab daily, and I see it is evolving in every release. However, I always have some complaints about its outdated GUI: The heavy toolbar reminds me of the MS office 2007.

Matlab toolbar

I know it can be hidden, but these useful buttons will be hidden too. In addition, there is no dark theme, making it difficult to work at night. In this post, I will show you some alternative ways to use Matlab.

Matlab IDE

The Matlab we are talking about has multiple meanings: the programming language with an interpreter, and the Matlab desktop with a GUI. If you are familiar with other programming languages, you will know that such an integrated development environment (IDE) is not always necessary, and there may be many IDEs available.

To start Matlab without the desktop (Linux and macOS), you can use the command line:

1
matlab -nodesktop

Then you will enter the Matlab interactive terminal. For more startup options, for example -nojvm, see the Matlab documentation.

My point is that the Matlab desktop is not necessary to run Matlab scripts, and we can use a third-party IDE to run Matlab scripts. As for 2022, the VSCode is de facto the go-to IDE for coding in multiple languages.

VSCode extensions for Matlab

To make Matlab work in VSCode, you need to install some extensions. There is a one-click solution called Matlab Extension Pack.

Matlab Extension Pack

It includes 6 extensions, some of the important ones are:

  • MATLAB for Visual Studio Code: basic language support for MATLAB to VSCode. You will need to set up the linter (mlint) to make the most of it.
  • Matlab Code Run: run Matlab scripts in VSCode. Open the command palette (under “View” or with shortcut ctr+shift+p) and find the “Run Matlab File” command.
  • Matlab Interactive Terminal for VSCode. This extension allows you to start an interactive Matlab session in VSCode like other terminals. MATLAB Engine API for Python, installations instruction is available here. I had some struggles with this extension installation on macOS, hope you can pull it out.

These are unofficial extensions and many critical functions are missing. There is no debug support, and no variable window (workspace), so it is not meant for serious work. I heard rumors that Matlab is going to remake its GUI in a future release, and the Matlab online has already shipped with a dark theme (but still the old GUI layout). I hope they can have a VSCode-like GUI layout, and get rid of the JVM if possible.

Matlab online

All right, that is all for this post. Thank you for reading.

This post is licensed under CC BY 4.0 by the author.

Resampling: the Fourier Method

FFT-Based FIR Filtering Using Overlap-Add Method: a Matlab Implementation

Comments powered by Disqus.