I have an upper triangular matrix from which I need to extract the non-zero data in an increasing order and corresponding row and column numbers to use in the rest of the matlab program - can someone please suggest an efficient way to do this.
As an illustration , here is an example of a matrix that I can have :
0 16.38028519 57.19639932 109.1383791 168.7622095
0 0 12.41026354 41.10752608 80.27145093
0 0 0 8.356508551 29.60683208
0 0 0 0 6.510638154
0 0 0 0 0
I require an output :
Data Row Num Col Num
6.510638154 4 5
8.356508551 3 4
12.41026354 2 3
16.38028519 1 2
29.60683208 3 5
41.10752608 2 4
57.19639932 1 3
80.27145093 2 5
109.1383791 1 4
168.7622095 1 5
The size of the matrix can run into 100's - so an algorithm that is fast would make a tremendous difference.
Many Thanks for help.