VS Code + MATLAB ignoring breakpoints

49 ビュー (過去 30 日間)
Mike Ray
Mike Ray 2025 年 8 月 20 日
コメント済み: Mike Ray 2025 年 8 月 27 日
I'm new to VS Code, but I installed the MATLAB extension and just did a test file of nothing but print statements. Not a function, but a script. I put a breakpoint into the third print statement, and when I click on the left 'Run and Debug' Button and click 'Start Debugging', it appears to start the debugger, but the step in/out/over buttons are disabled and only pause, restart and stop are enabled.
What's weird is that when I press F5, which I think should be doing the same thing (?) It does appear to run and stop at my breakpoint, and the terminal gives the K>> prompt, but no floating buttons appear. If I go to the menu and try to do Run->Step, all of them are also shaded out, and F10/F11 don't appear to do anything.
I watched videos on how to do this, and when I click the buttons they do, it doesn't do the same thing on my computer.
In status, it shows MATLAB: Connected, and everything else appears to be the same as on the videos.
I'm using R2024A and the latest VS Code (1.103.1), so I'm not sure if this is a versioning issue (?)
I'm wondering if maybe I don't have VS Code set up correctly? I've been using the MATLAB IDE for years, so I know how debuggers are supposed to work...

採用された回答

Toby
Toby 2025 年 8 月 27 日
I had the same issue: when running a MATLAB script, it was ignoring my breakpoints. Below is how I solved it:
  1. In VS Code, press Ctrl+Shift+P, and search for Preferences: Open User Settings (JSON).
  2. Click on it and a file settings.json will open.
  3. In this file add a line "MATLAB.startDebuggerAutomatically": true
  4. Save the file and restart VS Code.
  5. Run the MATLAB script. It should pause at your first breakpoint.
  1 件のコメント
Mike Ray
Mike Ray 2025 年 8 月 27 日
This worked! Thanks so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by