MATLAB extension for Visual Studio CodeThis extension provides support for editing, running, and debugging MATLAB® code in Visual Studio® Code and includes features such as syntax highlighting, code analysis, navigation support, and more. You can use this extension with or without MATLAB installed on your system. However, to make use of the advanced features of the extension or run MATLAB code, you must have MATLAB R2021b or later installed. For more information, see the Get Started section. Note: This extension no longer supports MATLAB R2021a. To use advanced features or run MATLAB code, you must have MATLAB R2021b or later installed. InstallationYou can install the extension from within Visual Studio Code or download it from Visual Studio Code Marketplace. After installing the extension, you might need to configure it to make full use of all the features. For more information, see the Configuration section. Get StartedTo get started using the extension, open any MATLAB code file (.m), or create a new file and set the language to MATLAB. Basic Features (MATLAB not required)The extension provides several basic features, regardless of whether you have MATLAB installed on your system. These features include:
Advanced Features (requires MATLAB installed on your system)If you have MATLAB R2021a or later installed on your system, you have access to an additional set of advanced features. These features include:
Run and Debug MATLAB CodeTo run a MATLAB code file in Visual Studio Code, click the Run button at the top of the file. You also can use the To debug a MATLAB code file, add breakpoints to the file by clicking the area to the left of an executable line. Then run the file. Visual Studio Code stops at the first breakpoint. When Visual Studio Code is paused, you can use the Debug toolbar to peforms debugging actions such as Continue, Step into, and Stop. You also can enter commands in the MATLAB terminal to perform debug actions or change variable values. Use the Run and Debug view to see your workspace variables, watch points, and call stack. LimitationsThere are some limitations to running and debugging MATLAB code in Visual Studio Code:
ConfigurationTo configure the extension, go to the extension settings and select from the available options. MATLAB Install Path SettingIf you have MATLAB installed on your system, the extension automatically checks the system path for the location of the MATLAB executable. If the MATLAB executable is not on the system path, you may need to manually set the You can determine the full path of your MATLAB installation by using the For example, run the
In the extension settings, set the MATLAB Automatically Start Debugger SettingBy default, the extension automatically starts the Visual Studio Code debugger when MATLAB reaches a breakpoint. To disable automatically starting the Visual Studio Code debugger, set the MATLAB Index Workspace SettingBy default, the extension indexes all the MATLAB code files ( MATLAB Connection Timing SettingBy default, the extension starts MATLAB in the background when you open a MATLAB code file in Visual Studio Code. To control when the extension starts MATLAB, set the
MATLAB Max File Size for Analysis SettingBy default, the extension analyzes all files, regardless of their size, for features such as linting, code navigation, and symbol renaming. To limit the maximum number of characters a file can contain, set the MATLAB Show Feature Not Available Error SettingBy default, the extension displays an error when a feature requires MATLAB and MATLAB is unable to start. To not display an error, set the MATLAB Sign In SettingBy default, the extension assumes that the MATLAB installation specified in the Install Path setting is activated. To enable browser-based sign in to your MathWorks account using the Online License Manager or a Network License Manager, set the MATLAB Telemetry SettingYou can help improve the extension by sending user experience information to MathWorks®. By default, the extension sends user experience information to MathWorks. To disable sending information, set the For more information, see the MathWorks Privacy Policy. TroubleshootingIf the MATLAB install path is not properly configured, you get an error when you try to use certain advanced features, such as document formatting and code navigation. To resolve the error, set the MATLAB install path to the location of the MATLAB executable. For more information, see the Configuration > MATLAB Install Path Setting section. Contact UsWe encourage all feedback. If you encounter a technical issue or have an enhancement request, create an issue here or contact MathWorks at support@mathworks.com. Release Notes1.3.0Release date: 2024-12-18 Added:
Fixed:
1.2.0Release date: 2024-03-05 Added:
1.1.0Release date: 2023-06-05 Added:
Fixed:
1.0.0Release date: 2023-04-26
|