Code covered by the BSD License
function y=extract(x) [s1 s2]=size(x); nb=s1*s2/4; mm=1; for ii=1:2:s1 for jj=1:2:s1 yj=x(ii:ii+1,jj:jj+1); y(mm,:)=yj(:)'; mm=mm+1; end end
Contact us at files@mathworks.com