Infinite looping: Knowing its presence in a big program?

2 ビュー (過去 30 日間)
Jaya
Jaya 2021 年 10 月 25 日
コメント済み: John D'Errico 2021 年 10 月 25 日
I have a big code and multiple .m files connected to it. The program itself takes time and was running perfectly. But I made changes and I see the program running. But I have a slight doubt that maybe it is not progressing and is somewhere caught in infinite looping.
So, the curiosity to ask this question that are there any tricks or methods followed by programmers to catch the points of infinite looping in their codes so that it kind of stops or throws some exception,etc?

採用された回答

Jan
Jan 2021 年 10 月 25 日
You can prove, that there are no "tricks" to determine securely in advance if a program stops or runs in an infinite loop.
There is a limit for recursive calls in Matlab. If the code contains an iteration, testing if the current value differs from the last one, is not sufficient, because the value might be repeated with a certain period or chaotic.
  1 件のコメント
John D'Errico
John D'Errico 2021 年 10 月 25 日
The best you can probably do is to learn to use the debugger, and to use it effectively.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by