Have you ever executed a FOR or WHILE loop and wished you could pause and resume it to examine the status in the debugger?
To use the tool, code the "dbloop" command into your M-code loop at the location that you intend to pause the loop. While the loop is executing, press the "k" key on your keyboard to stop in the debugger at the next iteration. When you are done examining or debugging, Use the "return" or "dbcont" command to resume execution of the loop.
Read the M-file help for more details, including how to configure a different key than "k", and how to use multiple breakpoints. There is also an important disclaimer about using this tool for loops that involve graphics.
Greg Aloe (2021). dbloop.m: Dynamically enter debug mode during a loop (https://www.mathworks.com/matlabcentral/fileexchange/9736-dbloop-m-dynamically-enter-debug-mode-during-a-loop), MATLAB Central File Exchange. Retrieved .
very useful code! thanks.
Nice tool. Code contains a small bug:
- replace all dbs(end) by dbs(2), then the problem of Sanketh is resolved.
The idea of the tool is good, but I have a problem.
If I have functions inside functions, and I put a dbloop in one of the inside functions, it doesn't work.
Can this be solved?
This is an excellent code.But looks like it slows down the whole process
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!