VS code and Matlab joint debugging

Using Matlab in VS-code

After completing this configuration, you can write and run MATLAB code in vscode

Python configuration

Official guide: Call MATLAB from Python and check the corresponding version

Download Python: Download Python. If it feels slow, you can use the mirror CNPM Binaries Mirror. The Python directory is usually in

C:\Users\Administrator\AppData\Local\Programs\Python

Environment variables: You can choose whether to set the environment variable sysdm.cpl. In fact, you don’t need to set it. Multi-version installation requires different names.
Matlab configuration

Start API: Run setup.py in the Matlab installation directory ~\extern\engines\python

Command example (with environment variables, cd to directory)

python setup.py install

Command example (nothing):

C:\Users\Administrator\AppData\Local\Programs\Python\python39\python.exe
C:\ProgramFiles\MATLAB\R2022a\extern\engines\python\setup.py install

VS Code configuration
Plugin:
「Matlab」:自动补全、代码高亮 ,设置里添加 Matlab 目录可以把 Matlab 的配置文件给插件调用

「matlab-formatter」:代码格式化,设置需要 Python 路径

「Matlab Interactive Terminal」:终端运行,设置需要 Python 路径
Calling MATLAB from Python

https://ww2.mathworks.cn/help/matlab/matlab-engine-for-python.html?searchHighlight=pythons_tid=srchtitle_python_2

Download Python

https://www.python.org/downloads/

CNPM Binaries Mirror

https://registry.npmmirror.com/binary.html?path=python/

Reference video:

https://www.bilibili.com/read/cv16335795

Guess you like

Origin blog.csdn.net/weixin_49796643/article/details/127197062