From: Matt Fig on
Perhaps

permute(A,[2 1 3])

will do what you need.