Am i correct with my conversion of a Logical indexing to a for loop?
2 次查看(过去 30 天)
显示 更早的评论
Logical indexing is:
T ( T > 10) = 10;
My Loop is:
for (T>10)
T = 10?
Also how could i do a while loop?
thanks
0 个评论
回答(2 个)
Walter Roberson
2015-12-2
Your loop variable should be over all the valid indices of the array, and inside the loop you should have a test that decides what to do.
Once you understand while loops from your other questions you should be able to do the conversion for this question as well.
0 个评论
另请参阅
类别
在 Help Center 和 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!