필터 지우기
필터 지우기

Create matrix and write to excel

조회 수: 3 (최근 30일)
Lisa
Lisa 2014년 8월 18일
편집: Lisa 2014년 8월 20일
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?

채택된 답변

Stalin Samuel
Stalin Samuel 2014년 8월 18일
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)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by