Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

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

                    
2
Fail
 
%%
 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))
Error: Matrix dimensions must agree.