Using MATLAB in Visual Studio Code

Using MATLAB in Visual Studio Code

Integrate MATLAB into your VS Code workflow with the MATLAB extension for Visual Studio Code. Edit, run, and debug MATLAB code with syntax highlighting, code analysis, navigation, and more.

Start Editing Without Waiting for MATLAB

Open any .m file to get MATLAB syntax highlighting, code snippets, commenting, and code folding—no MATLAB installation required.

Run and Debug Your Code

Run files and code sections via the Run button or run MATLAB commands directly through the MATLAB terminal. Set breakpoints and interactively troubleshoot issues with the Run and Debug view.

Configuring an AI coding agent in Visual Studio Code to use tools provided by the MATLAB MCP Core Server

Use AI Coding Agents with MATLAB

Connect MATLAB to AI coding agents like GitHub Copilot with the MATLAB MCP Core Server for automated code execution and workflow integration.

Navigate Your Codebase

View a structured outline of your code, find references across files and jump directly to definitions.

Catch Common Errors Before Running Your Code

See diagnostics, warnings, and errors as you write code. Apply automatic fixes for common issues.

Running MATLAB code to generate plots and other output in a Jupyter notebook within Visual Studio Code

Run MATLAB in Jupyter notebooks

Use MATLAB directly through Jupyter notebooks without needing to leave Visual Studio Code.

Two Ways to Use the Extension

Use basic editing features without needing to have MATLAB installed. Connect to MATLAB to run code or make use of the advanced features of the extension.

Feature Without MATLAB With MATLAB R2021b or later
Syntax highlighting
Code snippets
Commenting
Code folding
Automatic code completion  —
Code navigation (Go to Definition, Find References, etc.)
Code outline
Code analysis (diagnostics and automatic fixes)
Source code formatting
Symbol renaming
Run files and selections
Debugging (breakpoints, call stack, etc.) 
Jupyter Notebook support