필터 지우기
필터 지우기

Matrix problems?

조회 수: 1 (최근 30일)
Ami
Ami 2011년 6월 6일
I have a 5x5 matriz and a vector of 5 numbers, I need to sort it, like the number one take one numer of the 1rst row of the matrix, I can do that and it send me this matrix
time=[1,7597 1,634 1,7157 1,6738 5 2,3452 2,1777 2,2866 4 2,6901 3,1412 2,9169 3 2,988 3,6032 1 2,69220 2,8268 2,7579 3,3256 4,5961 2 4,4812 4,3719 5,2720]
What I want is to know is the number that is was before in that position, cause I have to do do a sum of the 5 positions.

답변 (2개)

Walter Roberson
Walter Roberson 2011년 6월 6일
Use the two-output version of sort to get the indices that the values originally came from.

Chetan
Chetan 2011년 6월 6일
>>>What I want is to know is the number that is was before in that position, cause I have to do do a sum of the 5 positions.
> 'Indices' will give you the previous location of the sorted values
[valuesAftersorting indices]=sort(Put variable you want to sort here, 'ascend/descend');

카테고리

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