help-octave
[Top][All Lists]
Advanced

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

Re: Index expressions: .* vs &


From: Søren Hauberg
Subject: Re: Index expressions: .* vs &
Date: Sun, 08 Aug 2010 11:36:38 +0200

fre, 06 08 2010 kl. 10:47 +0200, skrev c.:
> On 6 Aug 2010, at 10:43, Mike B. wrote:
> 
> > Thanks Carlo.
> >
> > I wasn't aware there is a difference. Thought that octave treated a  
> > real-type zero as a boolean.
> 
> If you want you can force that behaviour by casting the result of your  
> product to logical:
> 
> z1 = logical ((a > 0) .* (a > 1));

Can't you just use the & operator? I.e.

  z1 = (a > 0) & (a > 1);

And isn't that equivalent to

  z1 = (a > 1);

?

Søren



reply via email to

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