Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news2.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe07.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
User-Agent: Thunderbird 2.0.0.24 (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$1@fred.mathworks.com> <hrukjn$dda$1@fred.mathworks.com> <hruo0e$5f8$1@fred.mathworks.com> <hruq21$nef$1@fred.mathworks.com> <hrv1e8$63j$1@fred.mathworks.com> <hrv26k$q4e$1@fred.mathworks.com> <hrv2en$d9t$1@fred.mathworks.com> <hrv36g$30g$1@fred.mathworks.com> <hrv3lh$44d$1@fred.mathworks.com>
In-Reply-To: <hrv3lh$44d$1@fred.mathworks.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 23
Message-ID: <m_EEn.5$0M5.2@newsfe07.iad>
NNTP-Posting-Host: 24.79.143.47
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe07.iad 1273175058 24.79.143.47 (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: news.mathworks.com 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)

or

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)