function index = findClosest(v, a)
%FINDCLOSEST Closest element in a vector.
%   INDEX = FINDCLOSEST(V, A) returns the index of the element of V with
%   the closest value to A.

%   Author: Damien Teney

tmp = abs(v(:) - a);
[trash index] = min(tmp);
