help-octave
[Top][All Lists]
Advanced

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

Re: lookup function


From: Paul Kienzle
Subject: Re: lookup function
Date: Mon, 1 Aug 2005 23:13:03 -0400

Indeed you are right. It is fixed now in CVS.

Thanks,

        - Paul

On Aug 1, 2005, at 11:30 AM, Claudio Belotti wrote:

help of function "lookup" states:

<< To get an index value which lies within an interval of the table use:
     idx = lookup(table(2:length(table)-1), y) - 1
This puts values before the table into the first interval, and values
after the table into the last interval. >>


am I wrong or this should be "+ 1"?

idx = lookup(table(2:length(table)-1), y) + 1
                                         ^^^

octave:1> table = 1:5
table =

  1  2  3  4  5

octave:2> idx = lookup(table(2:length(table)-1), 0) + 1
idx = 1
octave:3> idx = lookup(table(2:length(table)-1), 2.5) + 1
idx = 2
octave:4> idx = lookup(table(2:length(table)-1), 15) + 1
idx = 4



Claudio



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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