Can I use a look-up vector table to interpolate values?

1 回表示 (過去 30 日間)
Tiberius
Tiberius 2014 年 3 月 14 日
コメント済み: Tiberius 2014 年 3 月 14 日
In matlab, let's say I have a=[0 4.2 7.4 11.2] and b=[0 2 12 4 5.3 7.4 11 16]. I want to see where each value of b fits in a and return the lowest INDEX of the 2 boundaries. Thus, I'd like to have in the end a vector (same length as b) containing the respective indexes. c=[1 1 4 1 2 3 3 4] because, for example, 4.2<5.3<7.4, so I return the index of 4.2, which is 2. Hope I didn't make any mistakes and I was clear enough. Thanks in advance.

採用された回答

Walter Roberson
Walter Roberson 2014 年 3 月 14 日
編集済み: Walter Roberson 2014 年 3 月 14 日
See histc() when used in the two-output form.
  1 件のコメント
Tiberius
Tiberius 2014 年 3 月 14 日
[N,BIN] = histc(a,b) does the trick. Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by