该系统使用两个坐标点来生成距离。表 1 显示每个航点的坐标,表 2 显示航点的连接。
因此我需要产生距离,但我一直遇到这个问题;“??? 索引超出矩阵维度。” 我怎么解决这个问题。
以下是我的编码和存储在excel中的数据。
编码
M = xlsread('Region11.xlsx',1);
N = xlsread('Region11.xlsx',2);
Start = N(:,1);
End = N(:,2);
distance = distance([M(Start,3),M(Start,4)],[M(End,3),M(End,4)]);
a= deg2km(distance);
xlswrite('Region11.xlsx',a, 2,'C2');
区域 11 - 表 1
No. Waypoints Latitude Longitude
1 11001 1.37983 103.84421
2 11002 1.3808 103.84406
3 11003 1.38186 103.84375
4 11004 1.38376 103.84301
5 11005 1.3838 103.84293
6 11006 1.38361 103.84153
7 11007 1.38354 103.84118
8 11008 1.38342 103.84088
9 11009 1.38308 103.84022
10 11010 1.38301 103.8402
11 11011 1.37973 103.84191
12 11012 1.37964 103.84201
13 11013 1.37963 103.84206
14 11014 1.37983 103.8441
15 11015 1.38003 103.84408
16 11016 1.38003 103.84408
17 11017 1.37998 103.84411
18 11018 1.37982 103.84403
19 11019 1.37984 103.84371
20 11020 1.37991 103.84373
21 11021 1.37994 103.8439
22 11022 1.38001 103.84328
23 11023 1.37993 103.84315
24 11024 1.37977 103.8431
25 11025 1.37981 103.84308
26 11026 1.37978 103.84269
27 11027 1.37972 103.84266
28 11028 1.37948 103.84253
29 11029 1.37955 103.84232
30 11030 1.37965 103.84197
31 11031 1.37981 103.84188
32 11032 1.37987 103.84196
33 11033 1.38004 103.84175
34 11034 1.3801 103.84187
35 11035 1.38018 103.8417
36 11036 1.38024 103.84179
37 11037 1.38008 103.84207
38 11038 1.38021 103.84201
39 11039 1.37997 103.84213
40 11040 1.38013 103.8429
41 11041 1.38021 103.84289
42 11042 1.38022 103.84289
43 11043 1.38028 103.84367
44 11044 1.38028 103.84367
45 11045 1.38026 103.84363
46 11046 1.38052 103.844
47 11047 1.38053 103.84398
48 11048 1.38059 103.84407
49 11049 1.38099 103.84394
50 11050 1.381 103.84391
51 11051 1.3811 103.84388
52 11052 1.38108 103.84393
53 11053 1.38122 103.84387
54 11054 1.38127 103.84392
55 11055 1.38127 103.84384
56 11056 1.3816 103.8437
57 11057 1.38164 103.84374
58 11058 1.38169 103.84381
59 11059 1.38158 103.84354
60 11060 1.38157 103.84349
61 11061 1.38135 103.84289
62 11062 1.38133 103.84288
63 11063 1.38125 103.84286
64 11064 1.38124 103.84285
65 11065 1.38083 103.84286
66 11066 1.38083 103.84286
67 11067 1.38099 103.84203
68 11068 1.381 103.84203
69 11069 1.3817 103.841
70 11070 1.3817 103.84099
71 11071 1.38166 103.84094
72 11072 1.38199 103.84076
73 11073 1.38199 103.84076
74 11074 1.3824 103.84053
75 11075 1.3824 103.84053
76 11076 1.38242 103.84053
77 11077 1.38242 103.84053
78 11078 1.38247 103.84046
79 11079 1.38292 103.84028
80 11080 1.38291 103.84043
81 11081 1.38291 103.84039
82 11082 1.38295 103.84072
83 11083 1.38291 103.8407
84 11084 1.38306 103.84051
85 11085 1.38323 103.84038
86 11086 1.38338 103.84067
87 11087 1.38329 103.84069
88 11088 1.38331 103.84091
89 11089 1.38347 103.84079
90 560621 1.383063 103.840593
91 560623 1.38268 103.840794
92 560625 1.382201 103.841111
93 560627 1.381864 103.84128
94 560633 1.381204 103.84217
95 560634 1.381582 103.843162
96 560636 1.381192 103.843284
97 560635 1.380788 103.842238
98 560637 1.38034 103.842361
99 560638 1.380486 103.843468
100 560639 1.379957 103.8424
101 560640 1.380024 103.843584
区域 11 - 表 2
Start End Distance
11001 11002
11002 11003
11003 11004
11004 11005
11005 11006
11006 11007
11007 11008
11008 11009
11009 11010
11010 11011
11011 11012
11012 11013
11013 11014
11014 11001
11001 11015
11015 11048
11048 11002
11002 11053
11053 11058
11058 11003
11008 11089
11089 11086
11086 11085
11085 11009
11010 11079
11079 11078
11078 11074
11074 11072
11072 11071
11072 11035
11035 11033
11031 11030
11030 11011
11030 11012
11013 11029
11029 11027
11027 11024
11024 11019
11019 11018
11018 11014
11018 11017
11017 11016
11016 11015
11017 11021
11019 11020
11022 11023
11023 11024
11023 11025
11025 11040
11022 11042
11042 11041
11041 11040
11026 11027
11028 11029
11031 11032
11033 11034
11035 11036
11035 11037
11037 11038
11038 11039
11041 11065
11065 11066
11065 11063
11063 11064
11063 11061
11061 11062
11061 11060
11060 11059
11068 11067
11057 11056
11056 11058
11056 11054
11055 11053
11054 11049
11049 11050
11049 11051
11051 11052
11052 11046
11046 11047
11046 11048
11069 11070
11071 11070
11070 11072
11072 11073
11072 11074
11074 11075
11075 11076
11076 11077
11076 11078
11078 11081
11080 11081
11079 11081
11085 11084
11086 11087
11089 11088
11082 11083
560621 11087
11084 560621
11080 560621
11082 560621
11083 560623
560623 11077
560625 11073
560627 11069
560633 11068
560633 11062
560634 11059
560634 11057
560636 11064
560636 11050
560636 11055
560635 11067
560635 11066
560637 11038
560637 11036
560637 11040
560638 11042
560638 11043
560638 11047
560639 11039
560639 11032
560639 11026
560639 11025
560640 11022
560640 11045
560640 11020
560640 11021
560640 560640