Matrix problems?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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.
0 Commenti
Risposte (2)
Walter Roberson
il 6 Giu 2011
Use the two-output version of sort to get the indices that the values originally came from.
0 Commenti
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');
0 Commenti
Vedere anche
Categorie
Scopri di più su Shifting and Sorting Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!