I have a 6×6 matrix that, instead of being indexed from 1-6, I want to assign a vector to index the matrix.
For example,
k =
1 3 5 6 3 1 5 6 7 3 4 5 1 3 4 5 7 4 1 4 6 7 8 9 1 7 6 5 4 3 1 2 3 4 5 6
v =
7 8 11 12 13 14
How can I assign the values of v as the index to the rows of k?
And then, >> v'
ans =
7 8 11 12 13 14
as the index for the columns of k?
So that k(7,7)= 1 and k(14,14)= 6 and k(11,11)= 4
Best Answer