Code covered by the BSD License  

Highlights from
dbloop.m: Dynamically enter debug mode during a loop

5.0

5.0 | 2 ratings Rate this file 18 Downloads (last 30 days) File Size: 2.97 KB File ID: #9736

dbloop.m: Dynamically enter debug mode during a loop

by Greg Aloe

 

23 Jan 2006 (Updated 28 Mar 2006)

While executing code in a loop, this tool allows you to enter debug mode at the press of a button.

Editor's Notes:

This file was a File Exchange Pick of the Week

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 6.0 (R12)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
23 Apr 2008 Subramani Adhiachari

This is an excellent code.But looks like it slows down the whole process

06 Dec 2010 Sanketh

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?

14 Sep 2011 Marco

Nice tool. Code contains a small bug:
- replace all dbs(end) by dbs(2), then the problem of Sanketh is resolved.

26 Oct 2011 Samantha D

very useful code! thanks.

Please login to add a comment or rating.
Updates
28 Mar 2006

Added "dbloop any" option.
Added "dbloop close" feature.
Forced handlevisibility/off for easier use.

Tag Activity for this File
Tag Applied By Date/Time
development environment Greg Aloe 22 Oct 2008 08:13:31
keepgoing dbloop debug break breakpoint stop execution loop keyb Greg Aloe 22 Oct 2008 08:13:31
development environment pradeep r 15 Dec 2011 08:31:47
development environment pradeep r 15 Dec 2011 08:31:49

Contact us at files@mathworks.com