Hey Guys. How do you convert a logical index to a loop (for or while loop)?

7 views (last 30 days)
The logical index is: loop for T(T>10)=10
Thanks

Answers (1)

Walter Roberson
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

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!