Sort multidimensional array along one dimension

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.

 채택된 답변

Sean de Wolski
Sean de Wolski 2013년 12월 2일
If you want to sort along the fifth dimension, use:
xsorted = sort(x,5);

댓글 수: 3

Lennart
Lennart 2013년 12월 2일
편집: Lennart 2013년 12월 2일
The second value of the fifth dimension has all timepoints, I want to sort to that. The first value of the fifth dimension however has all the values, so I think thats why sort(x, 5) did not work. As I said above I already tried sorting it on the last dimension. I think I need something inbetween sortrows and sort.
It sounds to me like you really have two separate arrays: a 4d array for measurement and a 4d array for time. If you create these, you can sort them how you wish (use the second output from sort to do the ordering in both if necessary).
Ah terrific, this works

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

질문:

2013년 12월 2일

댓글:

2013년 12월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by