How to temporarily pause execution of a function for troubleshooting

2 visualizaciones (últimos 30 días)
Hello Programmers,
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

Respuesta aceptada

Jan
Jan el 22 de Jun. de 2021
Editada: Jan el 22 de Jun. de 2021
This is a job for the debugger:
if ~isreal(Variable)
keyboard
end
Or:
if ~isreal(Variable)
disp('problem reached') % And set a breakpoint here
end

Más respuestas (1)

Matt J
Matt J el 22 de Jun. de 2021

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by