Mencari nilai koordinat

Ada file”ref.dat” yang berisi nomor titik yang belum ada koordinatnya. Ada file kedua “val.dat”yang berupa file koordinat. Link dari dua data tersebut adalah ada nomer point( point number), yang jika nomernya sama, maka koordinatnya juga akan sama.

// There is file “ref.dat” contain number of points. And there is 2nd file “val.dat” contain coordinate. Link of both of them is the point number. If the number is same, so the coordinate will copied

Jumlah data pada “ref.dat” jauh lebih besar dari “val.dat” karena merupakan titik tiap ketinggian dengan interval tertentu

// Number of points of ” ref.dat” larger than “val.dat” because this is points at each level altitude with certain interval

% program untuk mencari koordinat

clear

clc

load ref.dat % file ini sebagai input nomer titik yang dicari koordinatnya

load val.dat % file ini adalah input nilai koordinat tiap point

a=ref(:,4);

b=val(:,3);c=val(:,1);d=val(:,2);

for j=1:1:length(a)

for i=1:1:length(b)

if a(j)==b(i)

x(j)=c(i);y(j)=d(i);

else

continue

end

end

end

%h=[a x' y'];

%save line.dat h -ascii

n=[ref(:,1) ref(:,2) ref(:,3) a x' y'];

save hasil.dat n -ascii


hasil disimpan dalam file “hasil.dat”