ask for new function

Dear all:

There has a three-d matrix, now I want to exchange the final n layers with the n three. Just like change 1 to 5, 2 to 4,5 to 1, 4 to 2 in the whole 5 layers.

Which function should I use? Thanks
If your 3D matrix is called myMatrix:

myMatrix=myMatrix[p][q][dimsize(myMatrix,2)-1-r]

Here, dimsize(myMatrix,2) returns the number of layers in your 3D matrix, and p, q, and r tell Igor to assign new points based on row, column, and layer indices.

Rick