Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Grabbing info from an .ndk file and making a .kml file

  1. Jan 26, 2012 #1
    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) );


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

    And it's wrong in so many ways
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?