필터 지우기
필터 지우기

Matlab Google Earth Toolbox to export kml files in batch

조회 수: 1 (최근 30일)
Rajib Mozumder
Rajib Mozumder 2013년 2월 9일
Hi, I was running a loop to create separate kml files (from hundreds of point data files) using matlab googleearth toolbox's ge_scatter function as follows:
files = dir('*.txt');
for k = 1:numel(files)
Data = load(files(k).name);
x = Data(:,1);
y = Data(:,2);
kmlStr = ge_scatter(x,y);
ge_output(files(k).name,[kmlStr])
end
Unfortunately, using files(k).name doesn't give an output (with the same name in the text file) because the conventional way is to write:
ge_output('filename.kml',[kmlStr])
But in this case, the output file is replaced each time the loop runs. Could anyone please tell me how to run the loop so that I get outputs with respective file names?
Thanks for your help!

답변 (1개)

the cyclist
the cyclist 2013년 2월 9일
I haven't used that Toolbox, so I am kinda guessing here.
Do you get an error message from the ge_output() command? Since files(k).name is a string, I don't quite see why this doesn't work.
Does the output filename have to end in ".kml"? In that case, you could first do
>> regexprep(files(k).name,'.txt','.kml')
to replace the ".txt" with ".kml".

카테고리

Help CenterFile Exchange에서 Google Earth에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by