how to step out of a for loop
Show older comments
during debugging, I need to complete a for loop and continue debugging line by line; when I press shift+F11 it gets out of debugging mode altogether
Accepted Answer
More Answers (2)
Walter Roberson
on 10 May 2012
2 votes
Put your cursor on the first executable line after the loop, and use the mouse menu item to execute until cursor. (Unfortunately there is no known shortcut key for that.)
Honglei Chen
on 10 May 2012
0 votes
You can manually set the loop variable to meet the loop ending condition.
3 Comments
Walter Roberson
on 10 May 2012
That will not work for a "for" loop. "for" ignores any user changes to the loop index variable and uses its own internal knowledge of how far it has proceeded.
Sean de Wolski
on 10 May 2012
This will not work. Any changes made to the for-loop variable are not stored at the end of the loop iteration.
Curiously, break is not working either.
Honglei Chen
on 10 May 2012
Thanks Walter and Sean, I never realize this.
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!