MATLAB Puzzler: Finding the two closest points
n = 10;
x = rand(1,n);
y = rand(1,n);
Brett and I took very different paths to solving this problem, he knows more about the statistics toolbox than I do and found a much shorter solution because there is a function that basically does this. As a benchmark. sticking with base MATLAB, I solved this in seven lines of code. Post your solutions in the comments area along with how long it took you to solve.
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.