Matlab Linear Indexing 3d Matrix