Hey Guys. How do you convert a logical index to a loop (for or while loop)?
7 views (last 30 days)
Show older comments
The logical index is: loop for T(T>10)=10
Thanks
0 Comments
Answers (1)
Walter Roberson
on 11 Nov 2015
for K = 1 : numel(T)
if T(K) > 10
T(K) = 10;
end
end
or
for K = find(T>10)
T(K) = 10;
end
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!