Breakpoints in Run Section

I have my code broken up into sections, but if I set a breakpoint and then "Run Section", it ignores the breakpoint. Is there a way to use breakpoints with "Run Section"?

Antworten (2)

Omar
Omar am 24 Apr. 2018

7 Stimmen

There is a way, simply write the word 'keyboard' where you want your 'Run Section' to stop, and it will enter debug mode at that line.

1 Kommentar

Shahrokh Abbasi-Rad
Shahrokh Abbasi-Rad am 10 Aug. 2018
This was actually a good way and I liked it, but it doesn't go to any loop and that's its limitation.

Melden Sie sich an, um zu kommentieren.

Sean de Wolski
Sean de Wolski am 16 Mai 2013

3 Stimmen

Nope.
When you "Run Section" what's essentially happening is:
eval(Section_Contents)
Thus there is no way to have break points. I agree this can be pretty frustrating. A workaround is to put a break point on the first line of a section, then run the file the normal way. You can now run the section while in debug mode.

Kategorien

Gefragt:

am 16 Mai 2013

Community Treasure Hunt

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

Start Hunting!

Translated by