Vectorization of for loop
Ältere Kommentare anzeigen
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 Kommentare
Stephen23
am 14 Mär. 2019
"How I can turn this loop into vectorized code?"
Why do you need to do that?
Yaser Alghawi
am 14 Mär. 2019
Akzeptierte Antwort
Weitere Antworten (1)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!