MATLAB: Do I receive NaNs when using the GRIDDATA function from MATLAB 6.5 (R13)

gridgriddataholeshpmacMATLABnanossurfsurfaceuxx

Why do I receive NaNs when using the GRIDDATA function from MATLAB 6.5 (R13)?
Using the following code in Unix and Mac:
x=sort(repmat(0:9,1,9))';
y=repmat(0:9,1,9)';
z=x.^2+y.^2;
gridres=35;
xi=[min(x): (max(x)-min(x))/gridres :max(x)];
yi=[min(y): (max(y)-min(y))/gridres :max(y)]';
[x2,y2,z2]=griddata(x,y,z,xi,yi);
surf(x2,y2,z2);
returns NaNs in the surface plot, resulting in holes in my plot. Using the same code on a Windows platform gives me no NaNs (holes) in the surface plot. The default "linear" interpolation of GRIDDATA is used.

Best Answer

This is a bug in MATLAB 6.5 (R13). Our development staff is investigating this issue.
To work around this issue, please try to use the MATLAB 4 GRIDDATA format. In this format, the GRIDDATA command is changed to the following:
[x2,y2,z2]=griddata(x,y,z,xi,yi,'v4');