Given a matrix A, and a matrix of column indices B, how to create a new matrix C from A and B
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!