how to convert decimal degree to utm using loops ?

조회 수: 5 (최근 30일)
Akim Mahmud
Akim Mahmud 2018년 1월 8일
댓글: ANKUR KUMAR 2018년 1월 8일
I have this X ( 51 by 51 ) and Y ( 51 by 51 ) lat and lon matrix and I want to convert them to UTM using the deg2utm function in a loop. deg2utm function says [x,y,utmzone] = deg2utm(lat,lon)
I am not how to loop to though the my X and Y matrix in this case. any help would be highly appreciated. Thanks
  댓글 수: 1
Akim Mahmud
Akim Mahmud 2018년 1월 8일
I have this code that I wrote but both my new XX lat and YY lon give me 51 by 1 matrix instead of 51 by 51
xx=[]; yy = [];
for i = 1:1:length(X3)
[x(i),y(i),utmzone] = deg2utm(X3(i),Y3(i));
xx(i,:) = x(i);
yy(i,:) = y(i);
end

댓글을 달려면 로그인하십시오.

채택된 답변

ANKUR KUMAR
ANKUR KUMAR 2018년 1월 8일
편집: ANKUR KUMAR 2018년 1월 8일
Firstly do the meshgrid of lon lat.
[lon_new,lat_new]=meshgrid(lon,lat);
for i=1:size(lon_new,1)
for ii=1:size(lon_new,2)
C(i,ii)= deg2utm(lon_new(i,ii),lat_new(i,ii));
end
end
I haven't run this code yet. If your problem is still is not resolved, please attach the .mat file.
  댓글 수: 5
Akim Mahmud
Akim Mahmud 2018년 1월 8일
I had to modify your code without using the meshgrid. Thanks
ANKUR KUMAR
ANKUR KUMAR 2018년 1월 8일
I have written the complete the complete code, so that others can understand too.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by