Problem 1117. Create array of all Distances between two Sets of Points : No Neural Network Toolbox

Solution 177535

Submitted on 15 Dec 2012 by Jean-Marie Sainthillier
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% filetext = fileread('xy_dstnc.m'); assert(isempty(strfind(filetext, 'dist')))

2   Pass
%% m=5; Start=rand(m,2); Final=rand(m,2); d=xy_dstnc(Start,Final); d=round(100*d)/100; d_expect=zeros(m); for i=1:m % 10 for j=1:m dx=Start(i,1)-Final(j,1); % 14 dy=Start(i,2)-Final(j,2); % 14 d_expect(i,j)=hypot(dx,dy); % 14 end end d_expect=round(100*d_expect)/100; assert(isequal(d_expect,d))

Suggested Problems

More from this Author241

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!