Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: logical scalar values input
Date: Mon, 25 May 2009 12:23:03 -0400
Organization: The MathWorks, Inc.
Lines: 32
Message-ID: <gvegkq$8es$1@fred.mathworks.com>
References: <gvedt1$f1n$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1243268570 8668 144.212.105.187 (25 May 2009 16:22:50 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 25 May 2009 16:22:50 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:542415



"Snow White" <gulesaman@gmail.com> wrote in message 
news:gvedt1$f1n$1@fred.mathworks.com...
> Hi,
>
> i wrote the following piece of code:
>
> if (isnan(A) || isnan(B) || isnan(C) || isinf(A) || isinf(B) || isinf(C))
>    value_chk=1;
> else
>    r = roots(p); %%computing roots of the equation inorder to find the 
> refractive index
>    [root_size rr]=size(r);
> end
>
> now i am getting these values although A=B=C are matrices of 1 or 0
>
> ??? Operands to the || and && operators must be convertible to logical 
> scalar values.

That's correct.  If any of A, B, or C are empty then ISNAN or ISINF on those 
varaibles will not return a logical scalar value, but will return a logical 
empty value.

By the way, you can use ~ISFINITE() on each variable to replace one call to 
ISINF and one call to ISNAN.

-- 
Steve Lord
slord@mathworks.com