[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lookup function
From: |
Claudio Belotti |
Subject: |
lookup function |
Date: |
Mon, 01 Aug 2005 17:30:39 +0200 |
User-agent: |
Debian Thunderbird 1.0.2 (X11/20050331) |
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
-------------------------------------------------------------
- lookup function,
Claudio Belotti <=