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

조회 수: 6 (최근 30일)
Alessandro Maria Laspina
Alessandro Maria Laspina 2021년 3월 15일
답변: Steven Lord 2021년 3월 15일
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.

답변 (1개)

Steven Lord
Steven Lord 2021년 3월 15일
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.

카테고리

Help CenterFile Exchange에서 Prepare Model Inputs and Outputs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by