PLEASE HELP ME find coresponding column indexes.
Ältere Kommentare anzeigen
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 Kommentare
Star Strider
am 4 Jan. 2015
‘Now i want to get the corresponding column index number from matrix W.’
Corresponding to what?
Stephen23
am 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
am 4 Jan. 2015
Image Analyst
am 4 Jan. 2015
Bearbeitet: Image Analyst
am 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
am 4 Jan. 2015
Interestingly you don't refer to matrix V at all. Is this intentional?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Matrices and Arrays finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!