help-octave
[Top][All Lists]

## Re: Create a logical array of 0

 From: David Bateman Subject: Re: Create a logical array of 0 Date: Fri, 3 Sep 2004 16:23:02 +0200 User-agent: Mutt/1.4.1i

```According to Josep Monés i Teixidor <address@hidden> (on 09/03/04):
> Hi!
>
> 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?)
>

Err, I just added code like zeros(m,n,"int8") about a week ago that got into
2.1.58, I didn't think about "logical". Reading the man-pages for zeros in
matlab at

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/zeros.html

The allowed types are

'double', 'single', 'int8', 'uint8', 'int16', 'uint16', 'int32', or 'uint32'.

as 'single' precision is not in octave at the moment, and taking this as a
reference zeros(m,n,classname) only works for the above classname minus
'single'.

The only version of matlab (R12) I have access to doesn't allow this
syntax, but instead treats the third argument as a numerical value and
creates a three dimensional matrix.

Given the above reference I don't beleieve Matlab itself can handle
zeros(m,n,'logical'). If your problem is memory then something like
logical(zeros(m,n,'int8')) should help..

D.

--
Motorola CRM                                 +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 01 (Fax)
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as:

[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary

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

```