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: Dario
Subject: Re: How to generate logical column vector from matrix rows?
Date: Sat, 29 Sep 2012 13:53:33 -0700 (PDT)

bpabbott wrote
> 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
> 
> _______________________________________________
> Help-octave mailing list

> Help-octave@

> https://mailman.cae.wisc.edu/listinfo/help-octave

thanks for a try, but i keep getting this error message
error: mx_el_eq: nonconformant arguments (op1 is 10x2, op2 is 10x5)
error: evaluating argument list element number 1

My matrix A is 10x5 matrix filled with values of -1, 0, 1.
The row is true if a combination of values -1 and 1 is appeared in any row
of the matrix.



--
View this message in context: 
http://octave.1599824.n4.nabble.com/How-to-generate-logical-column-vector-from-matrix-rows-tp4644771p4644777.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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