<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Creating a KML file in MATLAB, pulling info from an ndk file' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Creating a KML file in MATLAB, pulling info from an ndk file' posted on the 'Matlab' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2012 Programmers Heaven</copyright>
    <pubDate>Wed, 23 May 2012 14:25:25 -0700</pubDate>
    <lastBuildDate>Wed, 23 May 2012 14:25:25 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Creating a KML file in MATLAB, pulling info from an ndk file</title>
      <link>http://www.programmersheaven.com/mb/ctocplusplustomatlab/427009/427009/creating-a-kml-file-in-matlab-pulling-info-from-an-ndk-file/</link>
      <description>Hello, I'm making a KML file using the code found on this page: &lt;a href="http://www.mathworks.com/help/toolbox/map/ref/kmlwrite.html."&gt;http://www.mathworks.com/help/toolbox/map/ref/kmlwrite.html.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
But I have to grab the longitude and latitude on a .ndk file, and I'm not sure how to incorporate that into my script.&lt;br /&gt;
&lt;br /&gt;
This is what I have so far.  I know the .ndk part is right, but I don't know how to stick it back into the code that creates the kml.  Sorry ahead of time; I'm a total noob.&lt;br /&gt;
&lt;br /&gt;
inputFilename = 'M:\week2\may11.ndk';&lt;br /&gt;
inputFile = fopen(inputFilename);&lt;br /&gt;
&lt;br /&gt;
while (feof(inputFile) == 0)&lt;br /&gt;
    % Read input file in blocks of 5&lt;br /&gt;
    for i = 1:numLinesInBlock&lt;br /&gt;
        % Read line from input file&lt;br /&gt;
        currentLine = fgetl(inputFile);&lt;br /&gt;
        &lt;br /&gt;
        % If we have the first line, then process it&lt;br /&gt;
        if (i == 1)&lt;br /&gt;
            % Extract the information we need&lt;br /&gt;
            lat     = strtrim( currentLine(28:33) );&lt;br /&gt;
            lon     = strtrim( currentLine(35:41) );&lt;br /&gt;
        &lt;br /&gt;
        elseif (i == 2)&lt;br /&gt;
        CMT_ID      = strtrim( currentLine(1:16) );&lt;br /&gt;
        &lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
filename = 'M:\week2\week2.kml';&lt;br /&gt;
kmlwrite(filename, lat, lon, 'Name,' CMT_ID);&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ctocplusplustomatlab/427009/427009/creating-a-kml-file-in-matlab-pulling-info-from-an-ndk-file/</guid>
      <pubDate>Thu, 26 Jan 2012 01:18:15 -0700</pubDate>
      <category>Matlab</category>
    </item>
    <item>
      <title>Re: Creating a KML file in MATLAB, pulling info from an ndk file</title>
      <link>http://www.programmersheaven.com/mb/ctocplusplustomatlab/427009/427020/re-creating-a-kml-file-in-matlab-pulling-info-from-an-ndk-file/#427020</link>
      <description>Sorry, I can't understand what is your problem...&lt;br /&gt;
There are variables not defined in your code, and I don't know what is the content of the .ndk file, so I can't understand what are you asking.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ctocplusplustomatlab/427009/427020/re-creating-a-kml-file-in-matlab-pulling-info-from-an-ndk-file/#427020</guid>
      <pubDate>Thu, 26 Jan 2012 03:09:03 -0700</pubDate>
      <category>Matlab</category>
    </item>
    <item>
      <title>Re: Creating a KML file in MATLAB, pulling info from an ndk file</title>
      <link>http://www.programmersheaven.com/mb/ctocplusplustomatlab/427009/427065/re-creating-a-kml-file-in-matlab-pulling-info-from-an-ndk-file/#427065</link>
      <description>The .ndk file is in this &lt;a href="http://geomechanics.geology.pdx.edu/Courses/G324/Week01/CMT-Data.zip"&gt;zip file&lt;/a&gt;.  Here is the &lt;a href="http://www.ldeo.columbia.edu/~gcmt/projects/CMT/catalog/allorder.ndk_explained"&gt;description&lt;/a&gt;.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ctocplusplustomatlab/427009/427065/re-creating-a-kml-file-in-matlab-pulling-info-from-an-ndk-file/#427065</guid>
      <pubDate>Fri, 27 Jan 2012 17:30:32 -0700</pubDate>
      <category>Matlab</category>
    </item>
    <item>
      <title>Re: Creating a KML file in MATLAB, pulling info from an ndk file</title>
      <link>http://www.programmersheaven.com/mb/ctocplusplustomatlab/427009/427100/re-creating-a-kml-file-in-matlab-pulling-info-from-an-ndk-file/#427100</link>
      <description>Ok, what is the problem with the code?&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ctocplusplustomatlab/427009/427100/re-creating-a-kml-file-in-matlab-pulling-info-from-an-ndk-file/#427100</guid>
      <pubDate>Mon, 30 Jan 2012 00:53:41 -0700</pubDate>
      <category>Matlab</category>
    </item>
    <item>
      <title>Re: Creating a KML file in MATLAB, pulling info from an ndk file</title>
      <link>http://www.programmersheaven.com/mb/ctocplusplustomatlab/427009/427131/re-creating-a-kml-file-in-matlab-pulling-info-from-an-ndk-file/#427131</link>
      <description>Nothing.  Figured it out, thanks :)&lt;br /&gt;
&lt;br /&gt;
clc;&lt;br /&gt;
clear all;&lt;br /&gt;
&lt;br /&gt;
inputFilename = 'M:\week2\may11.ndk';&lt;br /&gt;
inputFile = fopen(inputFilename);&lt;br /&gt;
&lt;br /&gt;
numLinesInBlock = 5; % Each CMT record spans over five lines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
while (feof(inputFile) == 0)&lt;br /&gt;
    for i = 1:numLinesInBlock&lt;br /&gt;
        currentLine = fgetl(inputFile);&lt;br /&gt;
        &lt;br /&gt;
        if (i == 1)&lt;br /&gt;
            % Extract the information we need&lt;br /&gt;
            description = strtrim( currentLine(57:80) );&lt;br /&gt;
            date        = strtrim( currentLine(6:15)  );&lt;br /&gt;
            time        = strtrim( currentLine(17:26) );&lt;br /&gt;
            latitude    = strtrim( currentLine(28:33) );&lt;br /&gt;
            longitude   = strtrim( currentLine(35:41) );&lt;br /&gt;
            depth       = strtrim( currentLine(43:47) );&lt;br /&gt;
            mb          = strtrim( currentLine(49:51) );&lt;br /&gt;
            ms          = strtrim( currentLine(53:55) );&lt;br /&gt;
            &lt;br /&gt;
        elseif (i == 2)&lt;br /&gt;
            CMT_ID      = strtrim( currentLine(1:16) );&lt;br /&gt;
            &lt;br /&gt;
            filename = 'M:\week2\week2.kml';&lt;br /&gt;
           kmlwrite(filename, latitude, longitude, 'Description', description);&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
fclose(inputFile);&lt;br /&gt;
fclose(outputFile);&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ctocplusplustomatlab/427009/427131/re-creating-a-kml-file-in-matlab-pulling-info-from-an-ndk-file/#427131</guid>
      <pubDate>Tue, 31 Jan 2012 17:02:44 -0700</pubDate>
      <category>Matlab</category>
    </item>
  </channel>
</rss>
