help-octave
[Top][All Lists]
Advanced

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

matrix and unique index


From: Laurent Jacques
Subject: matrix and unique index
Date: Tue, 7 Jan 2003 15:53:08 +0100
User-agent: KMail/1.4.3

Hello,

I'm a bit intrigued with matrix indexing with a single index in octave.
If 'a' is a matrix, why octave understands a(:) and not a(n) (with n integer) 
or a(end) ? 

For me, a(n) can be read as the nth component of vector a(:) created from the 
matrix a ?

Here is the example:
octave2.1:1> a=rand(3,3)
a =

  0.6815852  0.0056501  0.6384258
  0.6826963  0.2811865  0.2288755
  0.0042478  0.8020187  0.2920288

octave2.1:2> a(9)
error: single index only valid for row or column vector
octave2.1:3> a(end)
error: single index only valid for row or column vector
octave2.1:4> a(:)
ans =

  0.6815852
  0.6826963
  0.0042478
  0.0056501
  0.2811865
  0.8020187
  0.6384258
  0.2288755
  0.2920288

Thanks,
Laurent.




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