Vectorization of for loop
Show older comments
I have this for loop with conditionals inside it.
for i=1:m
for j=1:n
if (flipped_im(i,j,1)>flipped_im(i,j,2)) || (flipped_im(i,j,1)>flipped_im(i,j,3))
mod_im(i,j,:)=255;
else
mod_im(i,j,:)=flipped_im(i,j,:);
end
end
end
How I can turn this loop into vectorized code?
2 Comments
Stephen23
on 14 Mar 2019
"How I can turn this loop into vectorized code?"
Why do you need to do that?
Yaser Alghawi
on 14 Mar 2019
Accepted Answer
More Answers (1)
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!