Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Getting back to my workspace in the debugger after a symbolic error

조회 수: 1 (최근 30일)
Leo Simon
Leo Simon 2013년 2월 1일
마감: MATLAB Answer Bot 2021년 8월 20일
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개)

이 질문은 마감되었습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by