整理:VSCode配置Matlab环境

最简单方法:安装 Matlab Extension Pack。

这个插件里面含有最常用的三个vscode的matlab插件:

1)MATLAB for Visual Studio Code:用于高亮、代码提示、拼写检查等

   File>Preferences>User Settings添加:

       "matlab.mlintpath":mlint.exe文件路径

(如:"matlab.mlintpath": "C:\\Program Files\\MATLAB\\R2015b\\bin\\win64\\mlint.exe"

       "matlab.linterEncoding" : "gb2312"

       "files.associations": {"*.m": "matlab"}

2)MATLAB Runner:用于运行matlab代码

  1. In settings, find 'matlab-runner.matlabPath' and set it to the location of the matlab executable. For example (mac): '/Applications/MATLAB_R2017b/bin/matlab'
  2. Create an empty matlab file ('something'.m) and save it
  3. In settings, find 'matlab-runner.tempFilePath' and set it to the location of the file you just created. For example (mac): '/Users/username/Documents/temp.m'
  4. The setting 'matlab-runner.clearPastRuns' is a true or false value (defaults to true) that indicates whether or not the previous output should be cleared from the terminal window upon a following execution.
  5. The setting 'matlab-runner.powershell' is a true or flase value (defaults to false) that indicates whether or not matlab is being executed in powershell

While working on a MATLAB file, highlight the code you want to run, open the command palette to search 'Matlab: Run Selection', and execute the command.

The first time the command is executed it will open a new terminal for matlab which will take a few seconds, but each following execution will be instant.

Selecting 'Matlab: Run File' will run the entire contents of the current file. Make sure you save to see you changes reflected in the output.

简单来说就是:

打开:文件->首选项->设置
在用户文件中填入{
"matlab-runner.matlabPath": "matlab.exe文件的路径",
"matlab-runner.tempFilePath": "新建的.m文件
}

替换设置之后保存。
选择你需要运行的Matlab代码,并运行Matlab: Run Selection命令
 

3)matlab-formatter: 用于整理规范matlab代码

 

你可能感兴趣的:(●,Matlab)