BigList = rand(20, 3) LittleList = rand(5, 3)
I\'d like to find for each row in the big list the \'closest\' row in the little list, as defined by
You can do it with bsxfun:
d = squeeze(sum((bsxfun(@minus, BigList, permute(LittleList, [3 2 1]))).^2, 2)); [~, ind] = min(d,[],2);