This is a Matlab function and I'm trying to rewrite it in C. The input x1 is a 3 dimensional array and hx,hy,hz are just numbers. The problem I am having is understanding exactly how the elements of the 3D array are assigned. How does this last line work?
function Ax = D_XX_YY_ZZ(x1,hx,hy,hz)
[mx1, my1, mz1]=size(x1);
Ax = (x1(1:mx1-2,2:my1-1,2:mz1-1)+ ...
+x1(3:mx1,2:my1-1,2:mz1-1) )/(hx^2) + ...
(x1(2:mx1-1,1:my1-2,2:mz1-1)+ ...
+x1(2:mx1-1,3:my1,2:mz1-1) )/(hy^2) + ...
(x1(2:mx1-1,2:my1-1,1:mz1-2)+ ...
+x1(2:mx1-1,2:my1-1,3:mz1) )/(hz^2) ;