dbstopif(condition)

dbstopif is a much faster replacement for the built in conditional breakpoint

Vous suivez désormais cette soumission

When working with long loops of processing one may need to set a breakpoint to stop on a particular condition. While Matlab's built in conditional breakpoints achieve this, they exact a heavy performance penalty (even when disabled!), and are not generally maintained between sessions. dbstopif is inserted as a single line of code which which, if the condition is true, sets a regular breakpoint on the following line, resulting in an immediate dbstop.
A comparison of the time to execute a loop with many iterations:

Matlab conditional breakpoint enabled: Elapsed time is 34.412000 seconds.
dbstopif: Elapsed time is 0.004994 seconds.

Disabled:
Matlab conditional breakpoint disabled: Elapsed time is 51.132263 seconds.
dbstopif: Elapsed time is 0.004941 seconds.

Matlab conditional breakpoint removed: Elapsed time is 0.004422 seconds.
dbstopif: Elapsed time is 0.004628 seconds.

Citation pour cette source

Dan K. (2026). dbstopif(condition) (https://fr.mathworks.com/matlabcentral/fileexchange/62969-dbstopif-condition), MATLAB Central File Exchange. Extrait(e) le .

Catégories

En savoir plus sur Programming dans Help Center et MATLAB Answers

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux
Version Publié le Notes de version Action
1.0.0.0