How to convert for loop statement to matrix operation?
Show older comments
Hi, I am very new to using Matlab. Due to the processing issue, I would like to convert for-loop statement to matrix calculation to accelerate processing time.
For example,
[u v] = size(input_img);
for i=1:u
for j=1:v
if (input_img(i,j) == 0)
temp(i,j)=0;
end
end
end
Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!