help-octave
[Top][All Lists]
Advanced

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

logical and ????


From: John W. Eaton
Subject: logical and ????
Date: Tue, 11 Dec 2001 22:40:05 -0600

On 12-Dec-2001, Matthew Flax <address@hidden> wrote:

| When I  try the following I get a confusing answer :
| 
| octave:47> 0x4 & 0x8
| ans = 1
| 
| surely that should be ans=0 ?

No.  The & and | operators work element-by-element for matrices.  Your
0x4 and 0x8 numbers are just scalars, so the result is 1, which tells
you that both elements in the comparison are nonzero.  If you want
bit-wise operations, you need some functions to do it.  The matcompat
package may have some, but they aren't distributed as a part of Octave
(yet).

jwe



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