Sorting a Multidimensional Array

조회 수: 11 (최근 30일)
Luca Lange
Luca Lange 2021년 4월 23일
답변: Walter Roberson 2021년 4월 23일
Dear All,
I have measurement results in the form of a 65x48x504 array. I want to sort these 504 'layers' of data by a certain value, namely the data(1, 1, :) values.
It seems like sortrows() is limited to 2D cases, and I could not figure out how to use a for loop to adress the array correctly for this operation.
Any help is greatly appreciated!

채택된 답변

Walter Roberson
Walter Roberson 2021년 4월 23일
[~, idx] = sort(data(1,1,:));
sorted_data = data(:,:,idx);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by