フィルターのクリア

Loop. Do while loop in matlab

7 ビュー (過去 30 日間)
armin m
armin m 2021 年 12 月 4 日
編集済み: armin m 2021 年 12 月 4 日
Hi. I have wrote a code which contain main part like below.
Clc
Close all
.
.
.
While ...
.
.
.
End
I wanna force this loop to end in 7 iteration. I do this.
Clc
Close all
A=0
While A<8
While ...
.A=A+1
.
.
End
End
But it does not works. Can any body help?

採用された回答

Voss
Voss 2021 年 12 月 4 日
So you have some code like this, right?
A = 0;
while A < 8
% do something
A = A+1;
end
This loop will iterate 8 times (for values of A going from 0 to 7, inclusive). Is this what you observe? If not, what do you observe?
  3 件のコメント
Voss
Voss 2021 年 12 月 4 日
OK. How about this then?
% condition = <some unspecified condition>
A = 0;
while condition && A < 7
% do something
A = A+1;
end
armin m
armin m 2021 年 12 月 4 日
編集済み: armin m 2021 年 12 月 4 日
Did it. thankssss

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

その他の回答 (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