Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Getting back to my workspace in the debugger after a symbolic error
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
When you make an error using the symbolic toolbox, and dbstop if error is set, you may end up six workspaces down from where you want to be to debug the code. I find it very hard to get back to where I want to be in order to debug. Ideally we'd be able to type dbquit and get back to the right space, but dbquit kicks you out of the debugger. Here's a simple example
function nothing
A = sym('A',[1,2])
B = sym('A',[3,3])
A*B
If you run this, having first set dbstop if error, you'll end up here
> In sym.sym>sym.privBinaryOp at 1506
In sym.sym>sym.mtimes at 184
In test at 4
To get back to where you want to be, i.e., in test, you can type dbup twice, which gets you to test, leaving the two sym workspaces still active, so that when you make a second mistake, e.g. retype,
A*B
you end up with five workspaces
> In sym.sym>sym.privBinaryOp at 1506
In sym.sym>sym.mtimes at 184
In sym.sym>sym.privBinaryOp at 1506
In sym.sym>sym.mtimes at 184
In test at 4
Now if you type dbquit once you get rid of the top two spaces,
K>> dbstack
In sym.sym>sym.privBinaryOp at 1506
In sym.sym>sym.mtimes at 184
> In test at 4
but if you type dbquit a second time, hoping to get back to test, you end up at the command prompt, and have to start again
To summarize, is there a way to manage the debugger so that you (a) kill off the sym workspaces where the error occurred, and (b) end up in the workspace where the error occurred rather than back at the command prompt.
The only way I know to deal with this problem is to dbup to the place I want to be, then save the workspace, and debug from the command prompt after reloading the saved space. I'm quite sure there has to be a better way
0 Kommentare
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!