MATLAB Answers

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

1 view (last 30 days)
Tiberius on 14 Mar 2014
Commented: Tiberius on 14 Mar 2014
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.


Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 14 Mar 2014
Edited: Walter Roberson on 14 Mar 2014
See histc() when used in the two-output form.

  1 Comment

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Translated by