How do I simplify this command by avoiding cycle
Show older comments
At the end,I accept this code
destrows = repmat(ax, 1, 1,3);
destcols = repmat(ay, 1, 1,3);
[srcrows, srccols, srcpages] = ndgrid(1:iH, 1:iW, 1:3);
outImg(sub2ind(size(outImg), destrows, destcols, srcpages)) = tempImg(sub2ind(size(tempImg), srcrows, srccols, srcpages));
---
for x=1:iH
for y=1:iW
outImg(ax(x,y),ay(x,y),:)=tempImg(x,y,:);
end
end
Is it possible to use bsxfun?
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing 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!