MATLAB Answers

How to check the current line (debug)

14 views (last 30 days)
I often use 'keyboard' command to debug my programs (since sometimes I have to use command line and matlab -nodisplay setup). When the keyboard command is reached, the execution is stopped until I type return or dbquit. Sometimes, however, I would also like to know where the execution has been stopped, that is which function/script, which line. This might help me to trace down all keyboard instructions that I have put and that are reached during the execution. It this possible in Matlab R2011b?

  0 Comments

Sign in to comment.

Accepted Answer

Sean de Wolski
Sean de Wolski on 10 Apr 2012
Perhaps dbstack()?
doc dbstack

  1 Comment

Mateusz
Mateusz on 10 Apr 2012
Looks this is what I need, thanks!

Sign in to comment.

Sign in to answer this question.