<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237462</link>
    <title>MATLAB Central Newsreader - How to extract data out of a text file</title>
    <description>Feed for thread: How to extract data out of a text file</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>Mon, 13 Oct 2008 19:49:01 -0400</pubDate>
      <title>How to extract data out of a text file</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237462#605029</link>
      <author>Diego Zegarra</author>
      <description>Hey guys, &lt;br&gt;
I have .txt files that have the following structure and they all are different.&lt;br&gt;
&lt;br&gt;
12&lt;br&gt;
120&lt;br&gt;
&lt;br&gt;
81 79 85 97 91 75 60 98 79 56 91 82&lt;br&gt;
...&lt;br&gt;
..&lt;br&gt;
.&lt;br&gt;
74 74 64 86 90 59 98 74 53 56 81 58 &lt;br&gt;
50 90 76 68 53 57 60 73 72 62 99 55&lt;br&gt;
&lt;br&gt;
69 74 75 62 76 55 67 55 78 96 69 79 69 97 53 59 72 ... 56&lt;br&gt;
...&lt;br&gt;
..&lt;br&gt;
.&lt;br&gt;
89 78 91 72 59 52 92 96 95 95 74 98 99 68 55 69 66 ... 76&lt;br&gt;
&lt;br&gt;
So let me explain what this means. First the 12 and 120 means 12 machines (m) and 120 jobs (n). I want to be able to save this as a variable.&lt;br&gt;
&lt;br&gt;
Then the next block shows a number of jobs times number of machines matrix which I also want to save as a different variable.&lt;br&gt;
&lt;br&gt;
After that there are m blocks of data (12 in this case) with a matrix of nxn. I want to be able to save each of these blocks in a variable each.&lt;br&gt;
&lt;br&gt;
All my files will have a different number of machines and jobs so I want MATLAB to be able to read this automatically.&lt;br&gt;
&lt;br&gt;
Thank you so much for ANY help that is given! I appreciate your time responding to this!</description>
    </item>
    <item>
      <pubDate>Mon, 13 Oct 2008 20:17:01 -0400</pubDate>
      <title>Re: How to extract data out of a text file</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237462#605035</link>
      <author>Andres </author>
      <description>&quot;Diego Zegarra&quot; &amp;lt;diegozbb@gmail.com&amp;gt; wrote in message &amp;lt;gd08nd$dsr$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hey guys, &lt;br&gt;
&amp;gt; I have .txt files that have the following structure and they all are different.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 12&lt;br&gt;
&amp;gt; 120&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 81 79 85 97 91 75 60 98 79 56 91 82&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; ..&lt;br&gt;
&amp;gt; .&lt;br&gt;
&amp;gt; 74 74 64 86 90 59 98 74 53 56 81 58 &lt;br&gt;
&amp;gt; 50 90 76 68 53 57 60 73 72 62 99 55&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 69 74 75 62 76 55 67 55 78 96 69 79 69 97 53 59 72 ... 56&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; ..&lt;br&gt;
&amp;gt; .&lt;br&gt;
&amp;gt; 89 78 91 72 59 52 92 96 95 95 74 98 99 68 55 69 66 ... 76&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So let me explain what this means. First the 12 and 120 means 12 machines (m) and 120 jobs (n). I want to be able to save this as a variable.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Then the next block shows a number of jobs times number of machines matrix which I also want to save as a different variable.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; After that there are m blocks of data (12 in this case) with a matrix of nxn. I want to be able to save each of these blocks in a variable each.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; All my files will have a different number of machines and jobs so I want MATLAB to be able to read this automatically.&lt;br&gt;
&lt;br&gt;
Maybe txt2mat (file exchange) can help you with this; you could simply type&lt;br&gt;
A = txt2mat('C:\filename.txt');&lt;br&gt;
to get in all the data into one larger matrix (padded with NaNs where no data is available) and then examine this matrix to find out the indices of interest.&lt;br&gt;
Hth,&lt;br&gt;
Andres</description>
    </item>
    <item>
      <pubDate>Tue, 14 Oct 2008 07:01:03 -0400</pubDate>
      <title>Re: How to extract data out of a text file</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237462#605096</link>
      <author>Andres </author>
      <description>&quot;Andres &quot; &amp;lt;rantore@werb.deNoRs&amp;gt; wrote in message &amp;lt;gd0abt$1ro$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; [..]&lt;br&gt;
&amp;gt; A = txt2mat('C:\filename.txt');&lt;br&gt;
&amp;gt; [..]&lt;br&gt;
&lt;br&gt;
A small correction: rather tell txt2mat the number of header lines (zero, I guess), to ensure that the first two lines with the single numbers are imported to A as well:&lt;br&gt;
A = txt2mat('C:\filename.txt',0);</description>
    </item>
  </channel>
</rss>

