Mapping between two arrays wrt one column
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
SANGHAMITRA MISHRA
le 25 Déc 2017
Réponse apportée : Star Strider
le 25 Déc 2017
I have two matrices: A=[1 10; 2 20; 3 30] and B=[3 1 2]'
I want this to be my final answer A=[3 30;1 10;2 20] How do I do this?
0 commentaires
Réponse acceptée
Star Strider
le 25 Déc 2017
Use ‘B’ to define the rows of ‘A’:
A=[1 10; 2 20; 3 30];
B=[3 1 2]';
Anew = A(B,:)
Anew =
3 30
1 10
2 20
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Tables 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!