Indexing multidimensional arrays of arbitrary dimension

A post was split to a new topic: Help reshaping a 3D array