-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadjust_elevations.m
More file actions
58 lines (39 loc) · 963 Bytes
/
adjust_elevations.m
File metadata and controls
58 lines (39 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% Nima Ghaviha (nima.ghaviha@mdh.se)
% 2016-10-17
function Elevation = adjust_elevations(TDist, X, dest2)
Elev1 = xlsread(dest2, 'A1:B161');
T1 = size(Elev1);
SizeElev = T1(1,1);
xstep = X;
TotalDist = TDist;
Num = TotalDist/xstep + 1;
Elev3 = zeros(Num,2);
Elev2 = zeros(SizeElev(1,1)+1,2);
Elevation = zeros(Num,1);
ElevFinal = zeros(Num,1);
for i = 1 : SizeElev
Elev2(i,1) = (floor(Elev1(i,1)/xstep)+1);
Elev2(i,2) = Elev1(i,2);
end
for j = 1 : Num
Elev3(j,1) = j;
end
for k = 1 : SizeElev
Elev3(Elev2(k,1),2) = Elev2(k,2);
ElevFinal(Elev2(k,1),1) = Elev2(k,2);
end
temp = Elev2(1,2);
count = Elev2(2,1);
u = 2;
for p = 1 : Num
if p ~= count
Elev3(p,2) = temp;
ElevFinal(p,1) = temp;
else
temp = Elev2(u,2);
count = Elev2(u+1,1);
u = u + 1;
end
end
Elevation = ElevFinal;
end