I have upgraded to Matlab 2021b recently and found out that changes have been made regarding to the debugger and the 'Run section' command.
Previously, you could be debugging and interactively execute sections (either via the 'Run section' button or by hitting 'Ctrl+Enter').
This functionallity is no longer in the newest release.
What happens instead is that it seems like the 'Run section' is queued and executed after the debugger is ended.
A minimum working example:
disp('this one is printed')
disp('we want to print this more than once by hitting ctrl+enter')
disp('set a breakpoint on this line')
- Set a breakpoint on the last line of the function
- Execute function and see the output in the command window: "this one is printed" and "we want to print this more than once by hitting ctrl+enter"
- While still being in the debugger, try to execute the section with the second disp more than once (you can use 'Ctrl+Enter' or the 'Run section' button)
- The section is not executed, and we do not get any output
- Exit the debugger by pressing 'Continue'
- Output in the command window: "set a breakpoint on this line" and "we want to print this more than once by hitting ctrl+enter"
It seems like the execution from step 3 is registered, but only done AFTER the debugger is exited!
Another question having also issues with the 'Run section' functionality can be found here (there an error occurs and the debugger is not active):
Are there any plans to return to the original behaviour?