フィルターのクリア

How can i stop loop if all matrix elements are similar?

1 回表示 (過去 30 日間)
IB Ugur
IB Ugur 2017 年 8 月 31 日
編集済み: Matt J 2017 年 8 月 31 日
The matrix is modified in each iteration. When all elements of matrix are similar i want to stop the iteration. For example i tried by using codes shown below but it doesnt work. May you help me for solving this problem?
iteration=0;
np=10;
W=zeros(np,1);
while iteration<1000
Wupdate %The sub-script that modify the matrix
if np*W(1)==sum(W)
iteration=10000
end
end

採用された回答

Matt J
Matt J 2017 年 8 月 31 日
編集済み: Matt J 2017 年 8 月 31 日
if max(W(:))-min(W(:))<=tolerance
break;
end

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