From: "Keith Barth" <>
Newsgroups: comp.soft-sys.matlab
Subject: Fastest way to match the closest value in a vector.
Date: Sat, 14 Apr 2012 01:37:07 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 5
Message-ID: <jmakc3$61e$>
Reply-To: "Keith Barth" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1334367427 6190 (14 Apr 2012 01:37:07 GMT)
NNTP-Posting-Date: Sat, 14 Apr 2012 01:37:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3436349
Xref: comp.soft-sys.matlab:764393

Suppose I have a vector x in ascending order that is evenly spaced. (e.g., x=linspace(0,90,N) )

Suppose x(i)=<y<x(i+1). What is the fastest way to find i?

Thanks so much in advance!!!!! :)