I am new to this forum, so please bear with me. I have been working on this Matlab problem for a long time:
I have a digital elevation model (DEM) new_sub (x, y) in tif format. So this is an x-by-y matrix containing heights (z). I want to redo parts of this DEM in different resolutions and restore it in a different matrix. So far I have been working with loops to change the resolution of various areas of the DEM, and then writing the results to an xyz file:
xyz 1 1 123 1 2 233 1 3 231 2 1 235 2 2 531 2 3 452
etc. Here is the code:
xmax = size(new_sub,2);
ymax = size(new_sub,1);
for k=1:200 % y
for l=1:xmax % x
fprintf(fid, '%d %d %d \n',l,xmax+1-k,new_sub(k,l));
end
end
% 1:4
for k=200/2+1:size(new_sub,1)/2
for l=1:size(new_sub,2)/2
fprintf(fid, '%d %d %d \n',l*2,ymax+2-k*2,new_sub(k*2,l*2));
end
end
It works, but it seems rather complicated. Moreover, it does not allow me to save the tried areas in the same matrix inside Matlab.
, , , ? repmap, !
!
Theo