help-octave
[Top][All Lists]
Advanced

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

Re: Create a logical array of 0


From: Josep Monés i Teixidor
Subject: Re: Create a logical array of 0
Date: Fri, 03 Sep 2004 17:31:16 +0200

On dv, 2004-09-03 at 16:48, David Bateman wrote:
> Ok, this is a bug I introduced in the week before release. The problem
> is here.
> 
>    x = a * ones(idx, class(a))
> 
> as with the previously zeros(m,n,"logical") issue, ones(m,n,"logical")
> isn't defined!!! 

In this case (like in zeros) do you think it would be harmless to break
compatibility a bit and accept zeros(m,n,"logical") ? Since it's an
addition it's not the same as other imcompataibilities (is more like
"embrace and extend" hehe)

I can't see why MATLAB lacks of this. It to me as an overlook by MATLAB
developers (or perhaps they don't want people to use a lot logical
arrays?).


> A workaround for your case is repmat([false, false],10,5);


octave:74> m=repmat([false, false],10,5);
octave:75> whos m

*** local user variables:

  Prot Name  Size  Bytes  Class
  ==== ====  ====  =====  =====
   rwd m    10x10    800  matrix

Total is 100 elements using 800 bytes


-- 
Josep Monés i Teixidor
Clau GnuPG: gpg --recv-keys 80E85CC4

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]