sorting a matrix column with the corresponding row
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
neamah al-naffakh
le 22 Jan 2017
Commenté : Star Strider
le 5 Fév 2017
I have a matrix that contains ( 6 rows, 2 columns) as shown in the attached image.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160040/image.png)
I'd like to have a new matrix (in MATLAB) that contains the second columns arranged in ascending order, but would like to keep their corresponding values in the in the row. for example: the output matrix looks like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160041/image.png)
0 commentaires
Réponse acceptée
Star Strider
le 22 Jan 2017
Use the sortrows function:
A = [1 1; 3 8; 5 9; 6 3; 7 24; 8 8];
B = sortrows(A, 2)
B =
1 1
6 3
3 8
8 8
5 9
7 24
4 commentaires
Star Strider
le 5 Fév 2017
Neural networks are not currently an area of my expertise. I studied them extensively many years ago, and used the first few releases of the Neural Network Toolbox, but I have not used them recently.
First see the documentation for Getting Started with Neural Network Toolbox. Then see the documentation for Classify Patterns with a Neural Network. Those should get you started.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Pattern Recognition and Classification dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!