From: Walter Roberson <>
User-Agent: Thunderbird (Macintosh/20100228)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: What a hell is wrong with logical indexing??? Really???
References: <hrujad$fmn$> <hrukjn$dda$> <hruo0e$5f8$> <hruq21$nef$> <hrv1e8$63j$> <hrv26k$q4e$> <hrv2en$d9t$> <hrv36g$30g$> <hrv3lh$44d$>
In-Reply-To: <hrv3lh$44d$>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 23
Message-ID: <m_EEn.5$0M5.2@newsfe07.iad>
X-Trace: newsfe07.iad 1273175058 (Thu, 06 May 2010 19:44:18 UTC)
NNTP-Posting-Date: Thu, 06 May 2010 19:44:18 UTC
Date: Thu, 06 May 2010 14:44:18 -0500
Xref: comp.soft-sys.matlab:633278

Sergei Koulayev wrote:
> Do you agree that there 
> should be at least a warning when someone tries to write double into 
> logical?

Not unless you are also going to start giving a warning every time 
someone uses a double (other than 0 or 1) in a logical context such as

if VarName     %same as if all(VarName ~= 0)


B = ~~A;       %same as B = (A ~= 0)

If we are going to have warnings, then let us be consistent and have the 
warnings whenever anyone _evaluates_ a double in a logical context and 
that double does not happen to be be 0.0 or 1.0.

Wouldn't that be a squawk, the amount of code that would have to be 
touched up to avoid triggering "dbstop if warning"...

if logical(VarName)   %makes me think of  if islogical(VarName)