How to temporarily pause execution of a function for troubleshooting
2 views (last 30 days)
Show older comments
Commented: Telema Harry on 22 Jun 2021
I have sets of ODE equation that I am solving using ODE45.
For some unknown reasons, the model gives unrealistic result after 1600 seconds and the program terminates.
The model gives complex number as output.
I will like to pause the code as soon as any of the variable return a complex number and troubleshoot.
I used the "pause" command but i could not troubleshoot.
It is possible to do something like that in matlab
Jan on 22 Jun 2021
Edited: Jan on 22 Jun 2021
This is a job for the debugger:
disp('problem reached') % And set a breakpoint here
More Answers (1)
Matt J on 22 Jun 2021
You can set conditional breakpoints,
Find more on Ordinary Differential Equations 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!