help-octave
[Top][All Lists]
Advanced

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

Re: How to generate logical column vector from matrix rows?


From: Ben Abbott
Subject: Re: How to generate logical column vector from matrix rows?
Date: Fri, 28 Sep 2012 14:11:32 -0400

On Sep 28, 2012, at 2:00 PM, Dario wrote:

> Hey guys, 
> I'm a new Octave user. 
> I have one question for you. 
> Matrix is formed of values -1, 0, and 1.
> If I have -1 and 1 in one row of the matrix I need to get "true" for this
> row, otherwise I need to get "false".
> I need to loop through all rows of the matrix and get a logical column
> vector assigned to the matrix. 
> Please help me! :-)
> 
> P.S. sorry for mistakes, I'm new in English 

For "A" being your matrix, does this work for you?

        all (repmat ([-1, 1], size (A, 1), 1) == A, 2)

Ben



reply via email to

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