Watch this Author's files
line 66 - Y(i,j) = mean([NNnearest X(i,j)]); => Y(i,j) = mean([NNnearest Xpad(i,j)]);
Contact us at files@mathworks.com