필터 지우기
필터 지우기

Is there a way to throw an error whenever NaN occurs

조회 수: 17 (최근 30일)
Hechuan Wang
Hechuan Wang 2017년 5월 31일
댓글: Hechuan Wang 2017년 5월 31일
In most of my work, NaN is not a possible value. However NaN will not stop Matlab from working, so the error will occur some where after NaN happened. This is a trouble for me because the error message only shows the location where that NaN caused an error, but what I need is to find out where NaN was created.
What I wish is, NaN is set to be a kind of error, or throw an error whenever NaN occurs.
Is there anything that I can do?
Thanks

채택된 답변

Steven Lord
Steven Lord 2017년 5월 31일
No, you cannot directly make MATLAB throw an error when a NaN is created. But you can do something close to what you wish. One of the types of "Advanced Error Breakpoint Configuration" that you can set will cause MATLAB to stop execution when an Inf or NaN occurs. Search the documentation page to which I linked for that subsection title for more information.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by