整理: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代码

 

  • 2
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值