help-octave
[Top][All Lists]
Advanced

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

Re: Zero entries in one column of a matrix


From: Paul Kienzle
Subject: Re: Zero entries in one column of a matrix
Date: Fri, 2 Apr 2004 07:09:55 -0500

t1 = M(:,2) selects column 2
t2 = t1 ~= 0 turns the column into an index
t3 = M(t2,2) uses the boolean index t2 to select rows from column 2 of M

M(M(:,2) ~= 0,2) does all the above, including creating t1,t2,t3,
but not assigning names to them.

Paul Kienzle
address@hidden

On Thu, Apr 01, 2004 at 10:02:57AM -0800, Henry F. Mollet wrote:
Thanks for clear explanation.

Can I now also look at it as follows?
In M (: , 2) the ":" operator? says use all entries/rows in the second
column of M;
whereas in M (M(:,2) ~= 0 , 2), the implied ":" operator? looks at the
statement row by row and when it sees a boolean false (=0) says this is
*not* an index and therefore the entry (which was an actual 0) has to be
skipped?
Henry



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