help-octave
[Top][All Lists]
Advanced

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

Re: Invalid index error


From: Geraint Paul Bevan
Subject: Re: Invalid index error
Date: Mon, 02 Aug 2004 00:17:35 +0100
User-agent: Mozilla Thunderbird 0.5 (X11/20040306)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rich Shepard wrote:
|
|   I couldn't extract the values for each row in a for loop, so I did it
| sequentially. It's expedient but I know there _is_ a way to set up the
index
| and loop to do it in a couple of lines of code. Later; when there's time.
|

"prod" will get the product of all of the rows for you:

octave:1> a = rand(3,4)
a =

~  0.814724  0.835009  0.913376  0.308167
~  0.135477  0.126987  0.221034  0.097540
~  0.905792  0.968868  0.632359  0.547221

octave:2> prod(a,2)
ans =

~  0.19148600
~  0.00037091
~  0.30368215

- --
Geraint Bevan
http://homepage.ntlworld.com/geraint.bevan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iEYEARECAAYFAkENeg8ACgkQcXV3N50QmNPmYwCdFoLLRvUJhxYiYIw0peGWmST9
qZcAnAomwqJGZG/zTMHAlRcO+WwK/kw3
=3j1Q
-----END PGP SIGNATURE-----



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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