Shortcircuiting multiple dbquit commands
1 view (last 30 days)
Many times I find myself in a workspace, making an error, which throws me into debug mode, repeatedly making mistakes while trying to figure out what's going on, and then having to type dbquit, many many times to get myself back to a particular workspace. Is there some way to shortcircuit this process and get back to space I want to be in with a single command? (perhaps for example an undocumented argument to `dbquit` like dbquit('dumb')?) Here's a a really silly example. Suppose the following lines are in a file called dumb.m.
dbstop if error
f = @(x) x + y
If you run the file dumb, then you'll see the following error:
Undefined function or variable 'y'.
Error in dumb>@(x)x+y
Error in dumb (line 4)
and dbstack will return
In dumb (line 4)
Now, if you do a really stupid thing and type `y` three times, and then decide you want to get back to the workspace `dumb`, you'll need to type `dbquit` several (in fact 4) times, and, to be safe, `dbstack` after each one, to make sure that you haven't gone too far and exited the workspace `dumb`
The obvious answer---don't keep making the same stupid mistake---isn't applicable, since in my actual instances, the mistakes aren't so stupid. Thanks very much for any suggestions.