How do you set a breakpoint on multiple lines at once?

4 Ansichten (letzte 30 Tage)
Alessandro Maria Laspina
Alessandro Maria Laspina am 15 Mär. 2021
Beantwortet: Steven Lord am 15 Mär. 2021
I have a long code, and the error handling options are not respected most likely because the code I am using is part of a software package. Breakpoints are respected but the code is around 700 lines long and I don't want to have to set a breakpoint manually for each line everytime I restart matlab.
Yes I know its not efficient, but the code is a black box, I have no control over the inner workings, and this is the only way I can debug the process.

Antworten (1)

Steven Lord
Steven Lord am 15 Mär. 2021
Breakpoints are respected but the code is around 700 lines long and I don't want to have to set a breakpoint manually for each line everytime I restart matlab.
Why do you need to set a breakpoint manually for each line? I would set a breakpoint on the first line then step through the code from there.
If you need to restore the breakpoints, call dbstatus to create a struct array with information about the location of the breakpoints and pass that struct array into dbstop to restore those breakpoints.
If somewhere in the "black box" code you're running or in your code, if you're calling clear all then that would clear the debugging state. Try removing that and see if the error breakpoints functionality does what you need.

Kategorien

Mehr zu Prepare Model Inputs and Outputs finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by