storing variables in a table and retrieving them 1 by 1
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
Amit Bhowmick
el 1 de Jul. de 2021
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)
0 comentarios
Ver también
Categorías
Más información sobre NaNs en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!