HOME > テクニカルサポート > 製品 一覧 > SigmaPlot > ユーザーガイド > トランスフォーム関数一覧
ヒューリンクステクニカルサポート
皆様からのご質問のうち、よくある質問を掲載しました。
更新日: 14/05/08

lookup

関数 lookup は、複数の値と指定した表の境界区間とを比較し、1次元の表であれば対応するインデックス番号を、2次元の表であれば対応する値を返します。

 

構文

lookup(numbers, x table, y table)

引数 numbers は、指定した x table の中から検索する範囲として与えられる数値です。引数 x table は、各 x 区間の上限となる境界 (その値を含む) で構成される表で、その値は昇順にならべられている必要があります。下限値は、表の1つ手前の区間の値となります (最初の区間の下限値は -∞) 。

引数 numbersx table は、必ず指定しなければなりません。引数 numbersx table のみを指定した場合、関数 lookup は、x table 区間に対応するインデックス番号を返します。-∞ から 最初の区間境界まではインデックス 1、その次は 2、という具合です。

引数 numbers の値が x table の最後の値よりも大きい場合、関数 lookup は、インデックスとして欠損値を返します。x table の最後の値よりも大きい値を numbers に指定した場合は、インデックス番号として欠損値を返します。欠損値となることを防ぐには、x table の最後の値に 1/0 (無限大) を指定します。

オプション引数 y table は、インデックス番号 xy 値を割り当てるのに使用します。引数 y table のサイズは、引数 x table と同じ数にする必要がありますが、その要素の並びは特定の順序である必要はありません。引数 y table を指定した場合、関数 lookup は、 x table のインデックス値に対応する y table の値を返します。すなわち、インデックス 1 に対しては y table の最初の値が、インデックス2に対しては y table の2番目の値が割り当てられます。

Note: 引数 x tabley table の範囲は、一般に "lookup table (ルックアップテーブル)" と呼ばれるものに相当します。

 

例 1

 

例 2

lookup

The lookup function compares values with a specified table of boundaries and returns either a corresponding index from a one-dimensional table, or a corresponding value from a two-dimensional table.

Syntax

lookup(numbers,x table,y table)

The numbers argument is the range of values looked up in the specified x table. The x table argument consists of the upper bounds (inclusive) of the x intervals within the table and must be ascending in value. The lower bounds are the values of the previous numbers in the table (-∞ for the first interval).

You must specify numbers and an x table. If only the numbers and x table arguments are specified, the lookup function returns an index number corresponding to the x table interval; the interval from -∞ to the first boundary corresponds to an index of 1, the second to 2, etc.

If a number value is larger than the last entry in x table, lookup will return a missing value as the index. You can avoid missing value results by specifying 1/0 (infinity) as the last value in x table.

The optional y table argument is used to assign y values to the x index numbers. The y table argument must be the same size as the x table argument, but the elements do not need to be in any particular order. If y table is specified, lookup returns the y table value corresponding to the x table index value, i.e., the first y table value for an index of 1, the second y table value for an index of 2, etc.

Note: The x table and y table ranges correspond to what is normally called a “lookup table.”

Example 1

For n={-4,11,31} and x={1,10,30}, col(1)=lookup(n,x)places the index values of 1, 3, and -- (missing value) in column 1.

-4 falls beneath 1, or the first x boundary; 11 falls beyond 10 but below 30, and 31 lies beyond 30.

Example 2

To generate triplet values for the range {9,6,5}, you can use the expression lookup(data(1/3,3,1/3),data(1,3),{9,6,5}) to return {9,9,9,6,6,6,5,5,5}. This looks up the numbers 1/3, 2/3, 1, 1 1/3, 1 2/3, 2, 2 1/3, 2 2/3, and 3 using x table boundaries 1, 2, and 3 and corresponding y table values 9, 6, and 5.

 

前のページにもどる