整理:VSCode構成Matlab環境

2135 ワード

最も簡単な方法:Matlab Extension Packをインストールします.
このプラグインには、最も一般的な3つのvscodeのmatlabプラグインが含まれています.
1)MATLAB for Visual Studioコード:ハイライト、コードヒント、スペルチェック等に使用
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コードを実行する
  • In settings, find 'matlab-runner.matlabPath' and set it to the location of the matlab executable. For example (mac): '/Applications/MATLAB_R2017b/bin/matlab'
  • Create an empty matlab file ('something'.m) and save it
  • 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'
  • 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.
  • 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コードを整理する