Create matrix and write to excel

2 Ansichten (letzte 30 Tage)
Lisa
Lisa am 18 Aug. 2014
Bearbeitet: Lisa am 20 Aug. 2014
Hi everybody! I have the following problem: I nwant to create a matrix that shows the distance between each of these places. The matrix should then be written into a excel document. Somebody who can help me with the code?

Akzeptierte Antwort

Stalin Samuel
Stalin Samuel am 18 Aug. 2014
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)

Weitere Antworten (0)

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by