MATLAB-extension-for-vscode icon indicating copy to clipboard operation
MATLAB-extension-for-vscode copied to clipboard

Add breakpoints using dbstop

Open goldrik opened this issue 1 year ago • 0 comments

I have been experimenting with a workflow which involves editing MATLAB files using vs code, then running them by calling the script through an open MATLAB command window (separate from vs code).

Suppose you have a MATLAB script. You can add a breakpoint by using dbstop, like so Screenshot 2023-09-13 at 5 00 18 PM (3)

By running the script through the MATLAB command window, I get Screenshot 2023-09-13 at 5 00 35 PM (2)

Which creates a debug point here Screenshot 2023-09-13 at 5 00 35 PM (3)

I feel like there could be functionality to add breakpoints this way (for now). Perhaps adding a breakpoint in vs code could automatically add the line dbstop at [line number add 1] in [current file]

I know there is work to integrate MATLAB debugging in vs code, but this could be a simple workaround for now.

Edit: Apparently, the keyboard command may work better in this case. I have never tried this, but it could be a preferable alternative to the clunky dbstop line. Still, something to bind the add/remove debug point shortcut to this command would be great.

goldrik avatar Sep 13 '23 21:09 goldrik