clear all lt=[57:10:97] lg=[10:10:50] d=zeros(5,5) for i= 1:5 for j=1:5 dlat=lt(j)-lt(i) dlong=lg(j)-lg(i) a = (sin(dlat/2))^2 + cos(lt(i))*cos(lt(j))*(sin(dlong/2))^2; c = 2*atan2(sqrt(a), sqrt(1-a)); R = 6370;
d(i,j) =round( R*c) end end filename = 'test.xlsx'; xlswrite(filename,d)