There is already a submission to the file exchange from 2002 called find nearest.m which does the same thing, but in addition it has proper outputs and an optional 'bias' input for finding nearest values less than or greater than the test value. http://www.mathworks.com/matlabcentral/fileexchange/2838-findnearest-m
This is fantastic. It worked quickly on a matlab program that contains 184 functions. An additional capability that would be useful would be to have an option in fdep to copy all the non-toolbox dependencies to the current working directory, although I think I could write this myself from the information provided in the P structure. Thanks us.