MATLAB: Sort multidimensional array along one dimension

arraysort

I have a [80 80 3 646 2] sized array of measurements which represent [80 80 3] points each with its 646 values at [: : : : 1] and time of measurement at [: : : : 2]. Now I want to order this 5 dimensional array along the values of time of measurement (so I can more easily interpolate/downsample later, but the first step I cant figure out is ordering).
I tried the sort function on the last dimension, but that did not sort it along the time values.

Best Answer

If you want to sort along the fifth dimension, use:
xsorted = sort(x,5);