From help-octave-request at bevo dot che dot wisc dot edu Tue Dec 11 22:40:15 2001 Subject: logical and ???? From: "John W. Eaton" To: flatmax at cse dot unsw dot edu dot au (Matthew Flax) Cc: help-octave at bevo dot che dot wisc dot edu Date: Tue, 11 Dec 2001 22:40:05 -0600 On 12-Dec-2001, Matthew Flax 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 -------------------------------------------------------------