help-octave
[Top][All Lists]

## Re: Create a logical array of 0

 From: John W. Eaton Subject: Re: Create a logical array of 0 Date: Fri, 3 Sep 2004 11:59:10 -0400

```On  3-Sep-2004, David Bateman <address@hidden> wrote:

| but the test is long and it seems indexed booleans return a matrix!!

It seems that all of the following work as I would expect

x = logical (eye (2))
class (x)               => logical

class (x(2,2))          => logical

x(2,2) = logical (0)
class (x)               => logical

x(3,3) = logical (0)
class (x)               => logical

x = logical (0)
class (x)               => logical

class (x(1,1))          => logical

but

x(2,2) = logical (0)
class (x)               => double

which is clearly wrong, and prevents a solution like

x = logical (0);
x(m,n) = logical (0);

from approximating

zeros (m, n, "logical")

Is this what you meant, or did you notice some other problem with
indexing logical values?

In any case, the conversion to double is a bug and I will fix it.

Thanks,

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

```