storing variables in a table and retrieving them 1 by 1

조회 수: 1 (최근 30일)
abdul rehman
abdul rehman 2021년 7월 1일
답변: Amit Bhowmick 2021년 7월 1일
I want to store multiple values of letiude(lat1,lat2) and longitude (lon1,lon2) in a table and retrieving them 1 by 1 for following calculation
code:
lat1= 5.051099408347483; % latitude 1 5.03156496823464, 100.5242112313784
lat2= 5.031516767058222; % latitude 2 5.035615614086823, 100.52212496237453
lon1= 100.51424832033855 ; % longitude 1
lon2= 100.52419297410502 ; % longitude 2
R = 6371000; % metres
th1 = lat1 * pi/180; % φ, λ in radians
th2 = lat2 * pi/180; %
latch = (lat2-lat1) * pi/180;
lonch = (lon2-lon1) * pi/180;
a = sin(latch/2) * sin(latch/2) + cos(th1) * cos(th2) * sin(lonch/2) * sin(lonch/2);
c = 2 * atan2(sqrt(a), sqrt(1-a))
d = R * c %// in metres

답변 (1개)

Amit Bhowmick
Amit Bhowmick 2021년 7월 1일
use this,
Lat1=T.Lat(1) %T is the table name
Lat1=T.Lat(2)
To create table use,
Lat=[v1 v2 v3 v4]%Put valuea here
Long=[v1 v2 v3 v4]%Put valuea here
T=table(Lat,Long)

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by