If I am trying to write a "while" loop for while the bottom row of a matrix has only one non-zero value, what would I write after the "while" to specify only that condition?
2 ビュー (過去 30 日間)
古いコメントを表示
Nathan Sunnarborg
2017 年 4 月 27 日
コメント済み: Nathan Sunnarborg
2017 年 4 月 27 日
Lets say I have a matrix of:
zeros(6,7)
And I want to run a function only as long as there is one non-zero element in the 6th row. How would I do that until a second non-zero element is placed there?
0 件のコメント
採用された回答
Image Analyst
2017 年 4 月 27 日
Try this while m is your matrix:
while nnz(m(end, :)) == 1
% Do something
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!