I have this piece of code:
function Plot2DScatter(img1,img2)
n = size(img1,1);
m = size(img2,1);
axis([0 280 0 280])
hold on
for i=1:n
for j=1:m
x = img1(i,j);
y = img2(i,j);
plot(x,y);
end
end
end
it,s a function that will be used in a GUI. img1 and img2 are two 2048*2048 image matrixes.
so you see the loop should be repeated 4194304 times.
my problem is that it takes too much time for the system to complete the operation (about 45 minutes) and cpu-usage is really high. and when it is done so much physical memory (RAM) is needed (about 45 percent) that the computer gets hanged.
Is there anything that I can do to decrease the pressure applied to the system and do the operation faster?