天天看點

為VScode 配置Matlab運作環境(插件Matlab runner)在拓展中搜尋Matlab runner 并下載下傳SetupUsing MATLAB Runner

在拓展中搜尋Matlab runner 并下載下傳

下載下傳完成後我們進行配置 插件首頁的配置方法如下

Setup

  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.

Using MATLAB Runner

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指令

繼續閱讀