 function [indices]=find2(data, value);
 
 %finds the index of data value which is closest to given value
 
 indices=min(find(abs(data-value) == min(abs(data-value))));
 