如何使用VSCode进行matlab程序的Git同步及运行
1 Git连接
根据个人经验:请先进行Git的设置,之后在设置好Git base的文件夹右键使用VSCode打开,不会出现无法同步或者error 100XX的错误。
Git 及 Github设置,主要用于版本控制。
参考链接:
git+vscode进行版本控制 (可以作为学习Git Bash操作和利用VSCode进行fetch和pull操作的参考,不建议用作设置)
2 Matlab 在VSCode中的运行
参考链接:
【VS Code配置matlab】手把手教学,matlab也能自动补全+瞬间启动+代码整理!
也可以在安装完指定的扩展程序后,将以下的代码行复制到设置中的json文件中。
{
"workbench.colorTheme": "Default Light+",
"git.autofetch": true,
"matlab-interactive-terminal.CursorBack": true,
"matlab-interactive-terminal.unicodeSwitch": true,
"matlab.matlabpath": "D:\\Matlab\\R2019b\\bin\\matlab.exe",
"matlab.mlintpath": "D:\\Matlab\\R2019b\\bin\\win64\\mlint.exe",
//以上为matlab程序的路径,根据本机路径更改
"matlab.linterEncoding": "gb2312",
"code-runner.executorMap":{
"matlab": "cd $dir && matlab -nosplash -nodesktop -r $fileNameWithoutExt",},
"files.associations": {"*.m": "matlab
"code-runner.runInTerminal": true,
"[matlab]" : {"files.encoding": "gb2312",},
"files.autoGuessEncoding": true,
}
需要说明的是,运行每次都会打开matlab的命令窗口,且无法直接输入参数,可以另外建立一个m文件,输入带参数的函数运行命令行。