This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
function [index1, index2] = nearestNumbers(A)
s=[1,1,Inf];
for i = 1:length(A)-1
for j= 1:length(A)-i
s1=[i,i+j,abs(A(i)-A(i+j))];
if s1(3)
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!