How do I get rid of the K>> prompt?

207 views (last 30 days)
Stacey
Stacey on 10 May 2016
I keep getting stuck in K>> mode. I've tried hitting return several times, typing dbquit, home, and clc. None of these work. I'm using version R2015b. Thanks in advance for your help.
  1 Comment
Stephen23
Stephen23 on 10 May 2016
To quit the debugger:
press Shift + f5
or call
dbquit
To continue running the code:
press f5
IMPORTANT: calling dbquit or shift+f5 does not clear the breakpoints from your files: as the documentation clearly states "All breakpoints remain in effect". So the next time the function runs (either by calling it or within a loop or callback) then MATLAB will enter debug mode again.
If the code is looping then you can use conditional breakpoints to avoid this.
Also if you have nested debugs then this only escapes the highest level debug mode...

Sign in to comment.

Answers (3)

Guillaume
Guillaume on 10 May 2016
You've got a K>> prompt because you've entered debug mode within a function, either because you put a breakpoint there yourself, or because you've issued a dbstop if error and an error occurred in the function.
home and clc will have no effect on that, but despite what you say dbquit will leave debug mode. If you still have a K>> prompt after dbquit is because you've reentered debug mode while already in a debug session. If you issue enough dbquit you will eventually leave debug mode.
Most likely, you're in this situation because you've issued dbstop if error, hit an error and thus entered debug mode, try to run the function that produced the error without leaving debug mode, meaning that you've entered a new debug mode again, and done that a few more times. So you're in a K>> prompt within a K>> prompt within a K>> prompt, ...
To escape from all these recursive debug sessions:
dbquit all
To stop entering debug mode on error:
dbclear if error

Kevin
Kevin on 10 May 2016
You can also end up in debug mode if your matlab script or function calls keyboard.

ABDULMAJEED ALYAZIDI
ABDULMAJEED ALYAZIDI on 28 Feb 2023
That becaue you're in the "Run next line mode". You should consider clicking the red stop sign to quit.

Categories

Find more on Debugging and Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!