<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173704</link>
    <title>MATLAB Central Newsreader - reading a .txt file with dates</title>
    <description>Feed for thread: reading a .txt file with dates</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sun, 03 Aug 2008 18:05:04 -0400</pubDate>
      <title>reading a .txt file with dates</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173704#447020</link>
      <author>ALEKSANDER </author>
      <description>Hi!&lt;br&gt;
&lt;br&gt;
I've got a file in this form:&lt;br&gt;
dd/mm/yy [integer]&lt;br&gt;
&lt;br&gt;
The first lines of my file (result.txt):&lt;br&gt;
30/07/08 161&lt;br&gt;
31/07/08 150&lt;br&gt;
01/08/08 151&lt;br&gt;
05/08/08 160&lt;br&gt;
&lt;br&gt;
And I wish to generate two vectors: x(n) with n as the n'th &lt;br&gt;
line in the file, with the dates in the form &quot;datenum&quot;, and &lt;br&gt;
the other offcourse y(n) with the corresponding numbers.&lt;br&gt;
&lt;br&gt;
to make it all crystall clear: &lt;br&gt;
x(1) = datenum(20/07/08) %this is wrong,but u get the idea!&lt;br&gt;
y(1) = 161&lt;br&gt;
...etc&lt;br&gt;
&lt;br&gt;
If the format of the file is difficult to read, I can &lt;br&gt;
easily change it, it's matlab-genrated.&lt;br&gt;
&lt;br&gt;
Thanks!&lt;br&gt;
Aleksander, Norway</description>
    </item>
    <item>
      <pubDate>Sun, 03 Aug 2008 19:52:01 -0400</pubDate>
      <title>reading a .txt file with dates</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/173704#447030</link>
      <author>Andres </author>
      <description>&quot;ALEKSANDER &quot; &amp;lt;aleksander.rise.gallala@gmail.com&amp;gt; wrote in&lt;br&gt;
message &amp;lt;g74s0g$j2h$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I've got a file in this form:&lt;br&gt;
&amp;gt; dd/mm/yy [integer]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The first lines of my file (result.txt):&lt;br&gt;
&amp;gt; 30/07/08 161&lt;br&gt;
&amp;gt; 31/07/08 150&lt;br&gt;
&amp;gt; 01/08/08 151&lt;br&gt;
&amp;gt; 05/08/08 160&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; And I wish to generate two vectors: x(n) with n as the n'th &lt;br&gt;
&amp;gt; line in the file, with the dates in the form &quot;datenum&quot;, and &lt;br&gt;
&amp;gt; the other offcourse y(n) with the corresponding numbers.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; to make it all crystall clear: &lt;br&gt;
&amp;gt; x(1) = datenum(20/07/08) %this is wrong,but u get the idea!&lt;br&gt;
&amp;gt; y(1) = 161&lt;br&gt;
&amp;gt; ...etc&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If the format of the file is difficult to read, I can &lt;br&gt;
&amp;gt; easily change it, it's matlab-genrated.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks!&lt;br&gt;
&amp;gt; Aleksander, Norway&lt;br&gt;
&lt;br&gt;
The file format is easy to read, by humans and by matlab :-)&lt;br&gt;
Obviously, get the plain numbers first, e.g. using textscan&lt;br&gt;
(you only need to tell textscan that '/' should be treated&lt;br&gt;
as a whitespace - look for the 'Whitespace' parameter in the&lt;br&gt;
doc), and then feed datenum with the properly arranged&lt;br&gt;
numbers, x = datenum(Y, M, D)&lt;br&gt;
regards&lt;br&gt;
Andres</description>
    </item>
  </channel>
</rss>

