I have a dataset where the variables look like this:
latitude longitude latitude1 longitude1 latitude2 longitude2 latitude3 longitude3
until you reach latitude99 and longitude99.
What I wish to do is calculate the distance between latitude and longitude and each of the pairs from 1 to 99. For example:
distance1 = geodist(latitude, longitude, latitude1, longitude1)
distance2 = geodist(latitude, longitude, latitude2, longitude2)
distance99 = geodist(latitude, longitude, latitude99, longitude99)
Obviously I do not want to manually type out each distance variable until distance99, is there a faster way to do this? Thank you.