Tips & Tricks
Follow


Find unsuppressed outputs in R2024b using dbstop

Adam Danz on 30 Oct 2024 (Edited on 30 Oct 2024)
Latest activity Reply by DGM on 30 Oct 2024

It's frustrating when a long function or script runs and prints unexpected outputs to the command window. The line producing those outputs can be difficult to find.
Starting in R2024b, use dbstop to find the line with unsuppressed outputs!
Run this line of code before running the script or function. Execution will pause when the line is hit and the file will open to that line. Outputs that are intentionaly displayed by functions such as disp() or fprintf() will be ignored.
dbstop if unsuppressed output
To turn this off,
dbclear if unsuppressed output
Stephen23
Stephen23 on 30 Oct 2024
Hurrah, this is great news! Time for me to update some old Answers threads :)
DGM
DGM on 30 Oct 2024
If you know of a good thread or two, I'd appreciate it if you could link them here. (I'm having trouble finding much)
Steve Eddins
Steve Eddins on 30 Oct 2024

This is one of my favorites in R2024b.

goc3
goc3 on 30 Oct 2024
That is helpful.
This would also be a great option in the Run-button options to toggle on or off, along with Pause on Errors, Pause on Warnings, etc. Or, perhaps that option exists and I have not yet found it.
Michelle Hirsch
Michelle Hirsch on 30 Oct 2024
We added this in the new desktop beta in 24b, but not the regular desktop.
Chen Lin
Chen Lin on 30 Oct 2024
Great to see more quick tip! Thanks for sharing, Adam.

Tags

No tags entered yet.