PLEASE HELP ME find coresponding column indexes.
Show older comments
I have a matrix V of size (3x3) and another matrix W (3x3), where off-diagonals are zero in matrix W and diagonals are non-zero. Then I have A=sort(diag(W)). Now I want to get the corresponding column index number from matrix W.
CODE IS GIVEN BELOW:
V= [3 4 5; 4 7 8;2 6 1];
W=[5 0 0;0 7 0;0 0 2];
A=sort(diag(W));
A =
2
5
7
Now i want the corresponding column index number. for example: in this problem first element is 2 and corresponding column index number 3 from matrix W. Similarly for 5 is 1 and for 7 is 2 respectively.
5 Comments
Star Strider
on 4 Jan 2015
‘Now i want to get the corresponding column index number from matrix W.’
Corresponding to what?
Stephen23
on 4 Jan 2015
Please edit your question.
- Format the code so that it is readable (use the {} Code button above the text box)
- Describe the problem in more detail (as Star Strider has already pointed out)
- Don't put three sentences in the title.
- Read this:
palash de
on 4 Jan 2015
Image Analyst
on 4 Jan 2015
Edited: Image Analyst
on 4 Jan 2015
Do you mean the rows and columns of V that correspond to values in A? Is so, why even bother to sort W? And what if the numbers in W don't appear in V? read this
Stephen23
on 4 Jan 2015
Interestingly you don't refer to matrix V at all. Is this intentional?
Accepted Answer
More Answers (0)
Categories
Find more on Matrices and Arrays 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!