[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
re: simple (not for me) operation on matrix
From: |
Riccardo Bernardini |
Subject: |
re: simple (not for me) operation on matrix |
Date: |
Tue, 13 May 2003 17:35:13 +0200 |
> hi *
>
> ive a big matrix (750 cols* 140 rows) for example:
>
> 1 2 3 2 4 5 6
> 3 4 6 5 3 2 1
> 2 4 5 6 7 8 8
> 6 7 5 4 3 2 1
>
> i need to obtain a new matrix where i sum line 1 and line 2, then line 3
> and line 4 and so on as:
>
> (1+3) (2+4)
> (2+6) (4+7)
>
> i'm coming crazy for such a simple thing, any idea ?
If M is your 750x140 matrix, just do
result = M(1:2:size(M,1), :) + M(2:2:size(M,1), :)
----------------------------------------------------------------------
Riccardo Bernardini
Dipartimento di Ing. Elettrica, Gest. e Mec.
via delle Scienze 208
33100 Udine (Italy)
e-mail: address@hidden
Tel. +39-0432-55-8271
Tel. +39-0432-55-8251
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------