Why does the Editor/Debugger not stop on breakpoints set in my MATLAB file function that is called from a script?

1 visualización (últimos 30 días)
I have breakpoints set before I run my code. However, when I run the code, the debugger does not stop at the breakpoints, and the breakpoints are removed.
Also, I notice that after I stop my script, the breakpoints are cleared. So, if something is clearing the breakpoints, why is the editor not reflecting this clearing immediately?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 19 de Mayo de 2010
Check for a CLEAR ALL commands anywhere before the breakpoint. As documented in the help for the CLEAR function:
clear all
clears all of the debug breakpoints.
You can resolve the breakpoint issue by commenting out all lines of code that refer to any incarnation of CLEAR that encompasses CLEAR ALL. There are a few CLEAR commands that encompass CLEAR ALL such as CLEAR JAVA. See the following URL for more information on the CLEAR command:
<http://www.mathworks.com/access/helpdesk/help/techdoc/ref/clear.html>
Concerning the delayed update of the editor window to reflect that breakpoints have been cleared, it is not possible to have an immediate update of the editor when breakpoints are cleared in the editor.
  2 comentarios
Chuck
Chuck el 18 de Jun. de 2016
Editada: Chuck el 18 de Jun. de 2016
Thanks for this answer, it was really helpful.
But I have to tell that it is really annoying. Clear all should not clear the breakpoints.
Walter Roberson
Walter Roberson el 19 de Jun. de 2016
clear all should only ever be used when you want to effectively reset your MATLAB session without bothering to quit MATLAB and restart it. When you are doing that, it does not make sense to keep breakpoints. You should be looking at clearvars instead of clear all
If you really need to keep breakpoints but want all files unloaded from memory and so on, then assign the output of dbstatus() to a variable, save that variable, clear all, load the file, pass the loaded variable to dbstop . You could create a script for this purpose. But again, chances are high you are overusing clear all
clear all should have been named illudium q-36 because it should be thought of as blowing your session to smithereens.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Language Support en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by