hi
i have a large multi dimentional matrix that i need to iterate pixel by pixel, lets say size(A) = [2000,2000,100];
each pixel that i iterate through i take it's neighbourhood .
btw, to my appication I have to iterate by for loop.
the problem: indexing , for example
b = A(i:i+10,i+i+10,:)
takes a very long time for some reason.
i performed timing with profiler and that line is the most expensive one (timely wise).
why is indexing such an expensive operation? is there another way to do this?
thanks
8 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_732668
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_732668
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_732693
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_732693
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_732741
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_732741
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_732745
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_732745
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_733729
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_733729
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_733744
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_733744
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_733896
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_733896
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_733914
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/475190-indexing-takes-a-very-long-time#comment_733914
Sign in to comment.