Not exactly sure what the question is, but note that XYZ is not the same as (x,y,z). In XYZ, x and y values are your index number, and Z is the values of the matrix. So in the first 401 rows the values show a steady ramp from 1-401 in x, the next 401 rows show a steady ramp from 1-401 in the y direction, and then the last 401 rows are your original Z values of 0.
If you are trying to capture the data in 3D (first sheet is X, 2nd sheet is Y, 3rd sheet is Z), you either need to explicitly assign the data sheet by sheet
XYZ(:,:,1) = x;
XYZ(:,:,2) = y;
XYZ(:,:,3) = z;
or you need to use reshape.
XYZ=[hs.XData; hs.YData; hs.ZData] % PLANE3d
XYZ = reshape(XYZ,length(x),length(y),[])