From help-request at octave dot org Fri Sep 3 09:43:16 2004 Subject: Re: Create a logical array of 0 From: Stefan van der Walt To: help at octave dot org Cc: Josep Mon?s i Teixidor , "Llista help a octave.org" Date: Fri, 3 Sep 2004 16:42:09 +0200 My version of MATLAB uses uint8 for black and white pictures, so there should be no need to accommodate 'logical'. Regards Stefan On Fri, Sep 03, 2004 at 04:23:02PM +0200, David Bateman wrote: > According to Josep Mon?s i Teixidor (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?) > > > > Thanks in advance, > > 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. > ------------------------------------------------------------- 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 -------------------------------------------------------------