function [N] = findnearest(DEPTH, LOGDEPTHS) % [N] = findnearest(DEPTH, LOGDEPTHS) % % This function finds the depth in the logging data (LOGDEPTHS) that is % closest to the given depth (DEPTH). % % ------------------------------------------------------------------------- % % Gilbert, L.A. and A. Burke, 2008, Depth-shifting cores % incompletely recovered from the upper oceanic crust, IODP Hole 1256D, % G-cubed, 2008gc002010. % % Revised 5/8/08, AB and LAG % for further information contact aburke@mit.edu or lgilbert@williams.edu distance = abs(LOGDEPTHS-DEPTH); [C,N] = min(distance);