0

How can I create a matlab debugger breakpoint on the current line of a .m matlab file, cause matlab to enter the debugger at that point? I.e., pause the current code execution and drop into the debugger?

This would help me because I edit matlab files in an external editor. Wen I save a file, matlab clears any breakpoints I have set in that file. I have tried:

dbstop at [current_file.m]

which does not work because it sets breakpoint at the first line in the file.

As an example, in python, this could be done by:

import IPython
IPython.embed()

2 Answers 2

4

You can use dbstop to stop at a specific line:

dbstop in FILESPEC at LINENO

help dbstop gives you all the options.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I tried this but for my purposes -- debugging code -- it's not robust, because if I edit the file above that line then the line number will be wrong. Then the break point will be above line with dbstop, and won't be triggered.
2

You can use keyboard to stop at a certain point in the code.
The only problem is that it requires editing the code each time you want to add\remove a breakpoint

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.