help-octave
[Top][All Lists]
Advanced

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

Re: function applied to each component in an if clause


From: Thomas Weber
Subject: Re: function applied to each component in an if clause
Date: Wed, 12 Mar 2008 22:45:03 +0100
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

On 12/03/08 02:04 -0700, sururi wrote:
> 
> When you assign 
> 
> lower = (x < 2)
> 
> you have a vector of trues and falses, right? So for 

Yes. The result of this comparison in Octave is a bool vector, which you can
then use for indexing. 

> but how does the code know that this lower vector is special? Because:
> 
> octave:4> type lower
> lower is a user-defined variable
> [  1,  1,  0,  0 ]

Try 
  typeinfo(lower)

I currently don't have a recent Octave version available, but there might be
some function to convert your lower2 to a bool vector.

  Thomas


reply via email to

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