I'm trying to plot a track line with a csv file of lan/lon coordinates. Because of the gap between the degrees, minutes, and seconds, I can't get it to plot. What is the best way to do this?

1 view (last 30 days)
My csv file is short:
T1a, 49 47 0, -126 39.0
T1b, 49 47 2, -126 38.55
T2a, 49 48 25, -126 39.5
T2b, 49 48 4, -126 39.0
T3a, 49 50 2, -126 40 0
T3b, 49 50 2, -126 39 2
T4a, 49 51 0, -126 40 1
T4b, 49 51 0, -126 39 2
T5a, 49 52 0, -126 40 0
T5b, 49 52 0, -126 39 15
T6a, 49 53 4, -126 39 85
T6b, 49 53 4, -126 39 0
M1a, 49 39 23, -126 20 0
M1b, 49 38 3, -126 20 0
M2a, 49 39 2, -126 15 0
M2b, 49 39 7, -126 15 0
M3a, 49 39 9, -126 13 0

Accepted Answer

Star Strider
Star Strider on 22 Nov 2014
Here is one approach:
D = {'T1a', 49 47 0, -126 39 0
'T1b', 49 47 2, -126 38 55
'T2a', 49 48 25, -126 39 5
'T2b', 49 48 4, -126 39 0
'T3a', 49 50 2, -126 40 0
'T3b', 49 50 2, -126 39 2
'T4a', 49 51 0, -126 40 1
'T4b', 49 51 0, -126 39 2
'T5a', 49 52 0, -126 40 0
'T5b', 49 52 0, -126 39 15
'T6a', 49 53 4, -126 39 85
'T6b', 49 53 4, -126 39 0
'M1a', 49 39 23, -126 20 0
'M1b', 49 38 3, -126 20 0
'M2a', 49 39 2, -126 15 0
'M2b', 49 39 7, -126 15 0
'M3a', 49 39 9, -126 13 0};
DLL = cell2mat(D(:,2:7));
DLat = DLL(:,1)+(DLL(:,2)+DLL(:,3)/10)/60;
DLon = DLL(:,4)+(DLL(:,5)+DLL(:,6)/10)/60;
figure(1)
plot(DLon, DLat)
grid
axis equal

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!