2d Matrix To 3d Matrix Matlab