|
"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
|