[Top][All Lists]

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

RE: Create a logical array of 0

From: Randy Gober
Subject: RE: Create a logical array of 0
Date: Fri, 3 Sep 2004 09:13:26 -0500

The expression logical(zeros(m,n)) has the "effect" of being a type
conversion, but is not really. What you are asking Octave to do is tell you
the non-zero entries in a zeros(m,n) matrix. I guess a better example would
be the non-zero case,
logical(4*eye(4)) == logical(eye(4)). You can see there is more than just
type conversion in the first expression, but still has the "effect" of type
conversion in the second, yet both expressions are equivalent. 

Still thinking about you real question (how to create the matrix directly). 


-----Original Message-----
From: Josep Monés i Teixidor [mailto:address@hidden 
Sent: Friday, September 03, 2004 8:24 AM
To: Llista help a
Subject: Create a logical array of 0


How can I create a logical array of zeros without conversions between types?

If tried zeros(m,n,"logical") but didn't work for logical.

I'm currently using logical(zeros(m,n)) but I think this makes a conversion
from double to bool (or it is smart enough to handle it?)

Thanks in advance, 

Josep Monés i Teixidor
Clau GnuPG: gpg --recv-keys 80E85CC4

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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