From: Igor on
Suppose we have some gray image ,or something , and we want to read some pixel values from it. The code should be something like:

================================================
L=200;
H=400;

Z=rand(H,L);

[iX,iY]=meshgrid(single(1:L),single(1:H)); %mask , region of interest

%-------1 (OK)
Zi=Z([100:104],[100:104]);
size(Zi) % returns [5 5] ,as expected


%-------2 (Works, but seem to be slow)
Zi=interp2(Z,iX,iY);
size(Zi) % returns [H L] ,as expected


%-------3 (Out of memory)
Zi=Z(iY,iX); %??? Out of memory. Type HELP MEMORY for your options.
size(Zi)

===================================================

What is the cause of Out of memory ? vars are not that huge...

Is there some FAST way to do the same?