Problem with debugging in MATLAB
9 次查看(过去 30 天)
显示 更早的评论
Hello all. My program in MATLAB opens at the beginning of the program figure in GUI, and then the program changes the positions of up to 16 images in each loop. when I try to debug my program, I get different subroutines that MATLAB opens by itself and sometimes I can't even stop the program because the program always jumps to another subroutine. matlab opens several of those subroutines, I'll show you 3 of them. I would like to ask why this is happening and if I should consider it as a error in my program. otherwise the program runs smoothly
0 个评论
采纳的回答
Peng Li
2020-3-25
If everytime you use step in during debug, MATLAB will step in each subroutine and sub-subroutines, and so on, because it's own functions may call another function, and several other functions might be called again and again.
After the program stops at where your breakpoint is, you can try to click the line where you want the program to stop, and click Run until cursor to let the program stop there.
Hopefully this is what you need.
2 个评论
Peng Li
2020-3-25
I don't think this is possible. You have to explicitely add a breakpoint where you want the program to stop. Otherwise, after you click the pause button, it stops anywhere random. You can nevigate back to your m file and click anywhere after a somewhat transparent triangle sign in front of the line where the program stops (it's actually a subroutine used in that line), and click Run until cursor.
It's not ideal i think. It's better to add a breakpoint where you want to check the state.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!