help-octave
[Top][All Lists]
Advanced

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

Re: matrix row


From: Søren Hauberg
Subject: Re: matrix row
Date: Mon, 19 Sep 2005 08:51:29 +0200
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050912)

You need the colon operator.
You want access to a row of a matrix. That is, you want access to a(1,1), a(1,2), ..., a(1,n) This can be done using a(1,:), where the colon means all values (in this case of the columns). If you only want the first three elements of row 1, you could do a(1,1:3), etc.

Hope that helps,
Søren

Mukesh wrote:
hello,
i was just wondering if one can point to a complete row of a matrix.

for example, i hav a matrix 'a=[ 1, 1, 2; 3, 5, 8; 13, 21, 34 ]' and i want to print first row of the matrix '[ 1, 1, 2 ]'..
but writing a(1) on the octave prompt doesnt give me that..

octave:46> a = [ 1, 1, 2; 3, 5, 8; 13, 21, 34 ]
a =

  1   1   2
  3   5   8
 13  21  34

octave:47> a(1)
ans = 1




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