I have the code below which compares and extract the closest date & time in data1 to data2. It works well but I don’t want duplicates. That is if a closest date in data1 is already assigned to another date in data2, that closest date cannot be assigned again. Instead the nearest closest date should be chosen. No closest data in data1 should be used twice.
[~,ind1] = min(abs(datenum(data2)-datenum(data1))); closest_time = data2(ind1,:)
Any thoughts?
Thanks!
Best Answer