필터 지우기
필터 지우기

How to temporarily pause execution of a function for troubleshooting

조회 수: 2 (최근 30일)
Telema Harry
Telema Harry 2021년 6월 22일
댓글: Telema Harry 2021년 6월 22일
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

채택된 답변

Jan
Jan 2021년 6월 22일
편집: Jan 2021년 6월 22일
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

추가 답변 (1개)

Matt J
Matt J 2021년 6월 22일

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by