フィルターのクリア

How to perform an infinite loop in matlab so that it is always running a sequence?

1 回表示 (過去 30 日間)
Mario Martos
Mario Martos 2016 年 7 月 6 日
回答済み: Swarooph 2016 年 7 月 6 日
Hello,
I would like to know how could perform an infinite loop using for or while ( true) for a sequence me is always running in the program because they do not know what the best form or as could implement , for that I'm always checking a thing I need .
Thank you very much.

回答 (1 件)

Swarooph
Swarooph 2016 年 7 月 6 日
Example from the documentation here .
Sum a sequence of random numbers in an infinite loop until a condition is met. In this example, that condition is, until the next random number is greater than an upper limit. Then, exit the loop using a break statement:
limit = 0.8;
s = 0;
while 1
tmp = rand;
if tmp > limit
break
end
s = s + tmp;
end

カテゴリ

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