Using MATLAB on vscode that's installed with WSL?

176 views (last 30 days)
Bit new to linux and WSL so I'm a little confused. I have vscode installed through wsl and ubuntu and MATLAB installed normally on my Windows11 pc. I got the MATLAB vscode extension and followed the setup guide to configure its install path which is through my 'program files' folder but I'm getting an error that "MATLAB was unable to start. If MATLAB is installed, confirm that the MATLAB executable path setting is properly configured."
Would I need to install MATLAB through linux for this to work? Or am I doing something wrong?
Thanks

Answers (1)

Shubham
Shubham on 18 Feb 2024
Hi Brandon,
It seems that you have installed vscode in WSL and you are facing difficulties using the MATLAB vscode extension. If you have MATLAB installed on Windows, you will not be able to directly run it from within WSL because WSL and Windows have separate file systems and executable environments.
You can use MATLAB extension in vscode directly in Windows as follows:
For running MATLAB in WSL, you can try modifying the path for MATLAB executable in the configuration settings. You can access the file systems for windows in WSL by using “/mnt/ in the file path. For more information on working across file systems you can refer to the following:
Alternatively, you can install MATLAB directly in WSL for running it through vscode extension. Have a look at the following MATLAB Answer discussing the installation of MATLAB on WSL:
As a last resort, if you want to keep MATLAB installed on Windows and use it from VS Code running in WSL, you can set up a remote execution configuration. You can try referring to the following MATLAB Answer: https://www.mathworks.com/matlabcentral/answers/12159-how-to-use-matlab-remotly
I hope this helps!

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!