Given a matrix A, and a matrix of column indices B, how to create a new matrix C from A and B
Afficher commentaires plus anciens
Consider the following 3 x 3 matrix A:
5 8 3
4 8 1
9 6 8
Consider the following 3 x 3 matrix B:
3 1 2
2 3 1
1 3 2
The rows of B contain the desired indexes of the rows of A. My goal is to create the matrix C:
3 5 8
8 1 4
9 8 6
So the rows of A are reshuffled according the indices in B. Any ideas on how to do this, preferably without loops?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!