PDA

View Full Version : Grabbing info from an .ndk file and making a .kml file


jadeco
Jan26-12, 03:23 AM
So I have to make a .kml file, but I'm grabbing some info (latitude, longitude) from an .ndk file. I'm not quite sure how to do this. Right now I have this (sorry it sucks, I'm a total noob)

inputFilename = 'M:\week2\may11.ndk';
inputFile = fopen(inputFilename);

while (feof(inputFile) == 0)
% Read input file in blocks of 5
for i = 1:numLinesInBlock
% Read line from input file
currentLine = fgetl(inputFile);

% If we have the first line, then process it
if (i == 1)
% Extract the information we need
lat = strtrim( currentLine(28:33) );
lon = strtrim( currentLine(35:41) );

elseif (i == 2)
CMT_ID = strtrim( currentLine(1:16) );

end
end
end

filename = 'M:\week2\week2.kml';
kmlwrite(filename, lat, lon, 'Name,' CMT_ID);

And it's wrong in so many ways