help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sum element of columns


From: Andrew Janke
Subject: Re: sum element of columns
Date: Tue, 16 Oct 2018 02:41:12 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1



On 10/16/18 2:15 AM, turbofib wrote:
a =

    9   1   6
    3   6   2
    1   9   8


i want this:


newArray=9+1+6;3+6+2;1+9+8

=15 11 18



The sum() function takes an argument that lets you control which dimension it sums along. Try `sum(a, 2)'`.


octave:4> sum(a, 2)'
ans =

   16   11   18

See `help sum` for details.

Cheers,
Andrew



reply via email to

[Prev in Thread] Current Thread [Next in Thread]