function [ iv ] = myinterp1n( X, v )
%MYINTERP1N returns the 1-D interpolated value
%   using 'nearest'. X is the vector and v is the
%   value to be interpolated.
%   Minas Spetsakis Nov. 2017

vr = round(v);
N  = length(X);
if vr<1
    iv = X(1);
    return;
end
if vr>N
    iv = X(N);
    return;
end
iv = X(vr);
end

