I have data = [1 1.2 1.3 1.5 1.8]
I want to find closest values before and after from data for this point, b = 1.23
How do I do this?
Here is another method. The vector data
need not be sorted and b
can be positive or negative.
[~,I] = min(abs(data-b));
c = data(I);