best way to get a vector from sparse matrix

Posted by niko on Stack Overflow See other posts from Stack Overflow or by niko
Published on 2010-04-15T12:10:48Z Indexed on 2010/04/15 12:13 UTC
Read the original article Hit count: 437

Filed under:
|

Hi,

I have a m x n matrix where each row consists of zeros and same values for each row.

an example would be:

M = -0.6 1.8 -2.3 0 0 0; 0 0 0 3.4 -3.8 -4.3; -0.6 0 0 3.4 0 0

In this example the first column consists of 0s and -0.6, second 0 and 1.8, third -2.3 and so on.

In such case I would like to reduce m to 1 (get a vector from a given matrix) so in this example a vector would be (-0.6 1.8 -2.3 3.4 -3.8 -4.3)

Does anyone know what is the best way to get a vector from such matrix?

Thank you!

© Stack Overflow or respective owner

Related posts about matlab

Related posts about sparse-matrix