|
"Ulrik Nash" <uwn@sam.sdu.dk> wrote in message <job94n$ble$1@newscl01ah.mathworks.com>...
>
> What I wish to achieve is the creation of matrix B, which has two columns. The first column contains the row index of the 1's under the diagonal, and the second column contains the associated column index. For example, for A the result would be:
>
> B = [3 1;4 1; 4 3]
>
> Is there a of achieving this without looping through A?
=============
Here's one way, though I'm not sure a loops would be sub-optimal
[i,j]=find(tril(A,-1));
B=[i,j];
|