Azzera filtri
Azzera filtri

Matrix problems?

1 visualizzazione (ultimi 30 giorni)
Ami
Ami il 6 Giu 2011
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.

Risposte (2)

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

Chetan
Chetan il 6 Giu 2011
>>>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');

Categorie

Scopri di più su Shifting and Sorting Matrices in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by