How to convert from a for loop to a while loop
古いコメントを表示
I need to modify the set of codes below to a while loop

3 件のコメント
Steven Lord
2016 年 12 月 13 日
What have you tried so far?
James Tursa
2016 年 12 月 13 日
編集済み: James Tursa
2016 年 12 月 13 日
Why do you need this converted? Is this homework? Why not get rid of the loop entirely and vectorize this operation?
Yuqing Zhu
2016 年 12 月 13 日
編集済み: James Tursa
2016 年 12 月 13 日
採用された回答
その他の回答 (1 件)
David Barry
2016 年 12 月 13 日
This does not need to be any kind of loop. You should learn about logical indexing in MATLAB. This can be done with one line of code.
Vector(Vector >=0) = Vector(Vector >=0) * 2;
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
