<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167664</link>
    <title>MATLAB Central Newsreader - about textread</title>
    <description>Feed for thread: about textread</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>Wed, 16 Apr 2008 13:11:02 -0400</pubDate>
      <title>about textread</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167664#426962</link>
      <author>Wu Zhiyong</author>
      <description>I have a lot of data to read into matlab.They are printed &lt;br&gt;
in the textfile as followed:&lt;br&gt;
&lt;br&gt;
airpressure staions  bias      MAE     RMSE    HR          &lt;br&gt;
&amp;nbsp;&amp;nbsp;200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;nbsp;300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;nbsp;&amp;#8230;&amp;#8230;&lt;br&gt;
I need to ignore the characters. I did it in two ways.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;1.delete the characters manually.And write the code as &lt;br&gt;
followed:&lt;br&gt;
&lt;br&gt;
[airpress sta bias mae rmse hr]=textread(filename,'%f %f %&lt;br&gt;
f %f %f %f');&lt;br&gt;
&lt;br&gt;
&amp;nbsp;2.add the symbol &quot;%&quot; in front of the characters manually:&lt;br&gt;
&lt;br&gt;
%airpressure staions bias      MAE     RMSE    HR          &lt;br&gt;
&amp;nbsp;&amp;nbsp;200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
%airpressure staions bias       MAE     RMSE    HR&lt;br&gt;
&amp;nbsp;300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;nbsp;&amp;#8230;&amp;#8230;&lt;br&gt;
&lt;br&gt;
And write the code as followed:&lt;br&gt;
&lt;br&gt;
[airpress sta bias mae rmse hr]=textread(filename,'%f %f %&lt;br&gt;
f %f %f %f','commentstyle','matlab');&lt;br&gt;
&lt;br&gt;
Both ways worked.But there are a large number of data &lt;br&gt;
files.And it costs too much time.  &lt;br&gt;
&amp;nbsp;&amp;nbsp;Do you have any other way to ignore the characters?&lt;br&gt;
&amp;nbsp;&amp;nbsp;Any suggestion is appreciated!&lt;br&gt;
&amp;nbsp;&amp;nbsp;Thank you!</description>
    </item>
    <item>
      <pubDate>Thu, 17 Apr 2008 04:58:40 -0400</pubDate>
      <title>Re: about textread</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167664#427157</link>
      <author>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)</author>
      <description>In article &amp;lt;fu4tt6$rjq$1@fred.mathworks.com&amp;gt;,&lt;br&gt;
Wu Zhiyong &amp;lt;wuzhiyong_163@163.com&amp;gt; wrote:&lt;br&gt;
&amp;gt;I have a lot of data to read into matlab.They are printed &lt;br&gt;
&amp;gt;in the textfile as followed:&lt;br&gt;
&lt;br&gt;
&amp;gt;airpressure staions  bias      MAE     RMSE    HR          &lt;br&gt;
&amp;gt;  200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
&amp;gt;airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;gt; 300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;gt; &amp;#8230;&amp;#8230;&lt;br&gt;
&amp;gt;I need to ignore the characters. I did it in two ways.&lt;br&gt;
&lt;br&gt;
Do *all* the lines containing text start with 'airpressure'?&lt;br&gt;
If so, then you can set the textscan() comment character to 'a'.&lt;br&gt;
-- &lt;br&gt;
&amp;nbsp;&amp;nbsp;&quot;When we all think alike no one is thinking very much.&quot;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-- Walter Lippmann</description>
    </item>
    <item>
      <pubDate>Thu, 17 Apr 2008 12:51:03 -0400</pubDate>
      <title>Re: about textread</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167664#427260</link>
      <author>Barry Williams</author>
      <description>textread is going away.  Try textscan instead.  You can &lt;br&gt;
skip fields.&lt;br&gt;
Barry&lt;br&gt;
&lt;br&gt;
&quot;Wu Zhiyong&quot; &amp;lt;wuzhiyong_163@163.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fu4tt6$rjq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I have a lot of data to read into matlab.They are &lt;br&gt;
printed &lt;br&gt;
&amp;gt; in the textfile as followed:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; airpressure staions  bias      MAE     RMSE    &lt;br&gt;
HR          &lt;br&gt;
&amp;gt;   200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
&amp;gt; airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;gt;  300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;gt;  &amp;#8230;&amp;#8230;&lt;br&gt;
&amp;gt; I need to ignore the characters. I did it in two ways.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  1.delete the characters manually.And write the code as &lt;br&gt;
&amp;gt; followed:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [airpress sta bias mae rmse hr]=textread(filename,'%f %f &lt;br&gt;
%&lt;br&gt;
&amp;gt; f %f %f %f');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  2.add the symbol &quot;%&quot; in front of the characters &lt;br&gt;
manually:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %airpressure staions bias      MAE     RMSE    &lt;br&gt;
HR          &lt;br&gt;
&amp;gt;   200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
&amp;gt; %airpressure staions bias       MAE     RMSE    HR&lt;br&gt;
&amp;gt;  300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;gt;  &amp;#8230;&amp;#8230;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; And write the code as followed:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [airpress sta bias mae rmse hr]=textread(filename,'%f %f &lt;br&gt;
%&lt;br&gt;
&amp;gt; f %f %f %f','commentstyle','matlab');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Both ways worked.But there are a large number of data &lt;br&gt;
&amp;gt; files.And it costs too much time.  &lt;br&gt;
&amp;gt;   Do you have any other way to ignore the characters?&lt;br&gt;
&amp;gt;   Any suggestion is appreciated!&lt;br&gt;
&amp;gt;   Thank you!&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Thu, 17 Apr 2008 20:05:06 -0400</pubDate>
      <title>Re: about textread</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167664#427371</link>
      <author>Andres Toennesmann</author>
      <description>&quot;Wu Zhiyong&quot; &amp;lt;wuzhiyong_163@163.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;fu4tt6$rjq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I have a lot of data to read into matlab.They are printed &lt;br&gt;
&amp;gt; in the textfile as followed:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; airpressure staions  bias      MAE     RMSE    HR          &lt;br&gt;
&amp;gt;   200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
&amp;gt; airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;gt;  300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;gt;  &amp;#8230;&amp;#8230;&lt;br&gt;
&amp;gt; I need to ignore the characters. [...]&lt;br&gt;
&lt;br&gt;
You may try txt2mat from the file exchange with&lt;br&gt;
A = txt2mat('Filename',0,6,'BadLineString','air');&lt;br&gt;
This should result in the matrix &lt;br&gt;
A = [200.0  44   1.82511   2.34681  2.78835  22&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;300.0  38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...]&lt;br&gt;
It would be interesting to know for me if this works&lt;br&gt;
reasonably fast.&lt;br&gt;
Regards&lt;br&gt;
Andres</description>
    </item>
    <item>
      <pubDate>Thu, 17 Apr 2008 20:19:03 -0400</pubDate>
      <title>Re: about textread</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167664#427375</link>
      <author>William Dampier</author>
      <description>&quot;Wu Zhiyong&quot; &amp;lt;wuzhiyong_163@163.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;fu4tt6$rjq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I have a lot of data to read into matlab.They are printed &lt;br&gt;
&amp;gt; in the textfile as followed:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; airpressure staions  bias      MAE     RMSE    HR          &lt;br&gt;
&amp;gt;   200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
&amp;gt; airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;gt;  300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;gt;  &amp;#8230;&amp;#8230;&lt;br&gt;
&amp;gt; I need to ignore the characters. I did it in two ways.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  1.delete the characters manually.And write the code as &lt;br&gt;
&amp;gt; followed:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [airpress sta bias mae rmse hr]=textread(filename,'%f %f %&lt;br&gt;
&amp;gt; f %f %f %f');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  2.add the symbol &quot;%&quot; in front of the characters manually:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; %airpressure staions bias      MAE     RMSE    HR          &lt;br&gt;
&amp;gt;   200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
&amp;gt; %airpressure staions bias       MAE     RMSE    HR&lt;br&gt;
&amp;gt;  300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;gt;  &amp;#8230;&amp;#8230;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; And write the code as followed:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [airpress sta bias mae rmse hr]=textread(filename,'%f %f %&lt;br&gt;
&amp;gt; f %f %f %f','commentstyle','matlab');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Both ways worked.But there are a large number of data &lt;br&gt;
&amp;gt; files.And it costs too much time.  &lt;br&gt;
&amp;gt;   Do you have any other way to ignore the characters?&lt;br&gt;
&amp;gt;   Any suggestion is appreciated!&lt;br&gt;
&amp;gt;   Thank you!&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
If you switch to textscan, which is virtually a drop-in&lt;br&gt;
replacement, then you can use fgetl(fid) and this will&lt;br&gt;
remove the entire first line.  If you then use textscan on&lt;br&gt;
the same fid then you won't have to make any changes to the&lt;br&gt;
original text-files.</description>
    </item>
    <item>
      <pubDate>Sun, 01 Jun 2008 13:59:02 -0400</pubDate>
      <title>Re: about textread</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167664#435288</link>
      <author>Wu Zhiyong</author>
      <description>&quot;Andres Toennesmann&quot; &amp;lt;rantore@werb.de&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fu8ahh$c8m$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Wu Zhiyong&quot; &amp;lt;wuzhiyong_163@163.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;lt;fu4tt6$rjq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; I have a lot of data to read into matlab.They are &lt;br&gt;
printed &lt;br&gt;
&amp;gt; &amp;gt; in the textfile as followed:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; airpressure staions  bias      MAE     RMSE    &lt;br&gt;
HR          &lt;br&gt;
&amp;gt; &amp;gt;   200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
&amp;gt; &amp;gt; airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;gt; &amp;gt;  300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;gt; &amp;gt;  &amp;#8230;&amp;#8230;&lt;br&gt;
&amp;gt; &amp;gt; I need to ignore the characters. [...]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You may try txt2mat from the file exchange with&lt;br&gt;
&amp;gt; A = txt2mat('Filename',0,6,'BadLineString','air');&lt;br&gt;
&amp;gt; This should result in the matrix &lt;br&gt;
&amp;gt; A = [200.0  44   1.82511   2.34681  2.78835  22&lt;br&gt;
&amp;gt;      300.0  38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;gt;      ...]&lt;br&gt;
&amp;gt; It would be interesting to know for me if this works&lt;br&gt;
&amp;gt; reasonably fast.&lt;br&gt;
&amp;gt; Regards&lt;br&gt;
&amp;gt; Andres&lt;br&gt;
&amp;gt; &lt;br&gt;
Thank you for your great work!&lt;br&gt;
I'm going on with my work after a wonderful vacation.&lt;br&gt;
yeah, Your code works fast.It really saves my time!&lt;br&gt;
But one more question:&lt;br&gt;
&amp;nbsp;&amp;nbsp;How can I ignore the blank line?&lt;br&gt;
for example:&lt;br&gt;
airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;nbsp;300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&lt;br&gt;
airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;nbsp;200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
........&lt;br&gt;
Thanks very much!</description>
    </item>
    <item>
      <pubDate>Mon, 02 Jun 2008 09:14:03 -0400</pubDate>
      <title>Re: about textread</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167664#435387</link>
      <author>Andres </author>
      <description>&quot;Wu Zhiyong&quot; &amp;lt;wuzhiyong_163@163.com&amp;gt; wrote in message &lt;br&gt;
&amp;lt;g1u9v6$2i4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; But one more question:&lt;br&gt;
&amp;gt;   How can I ignore the blank line?&lt;br&gt;
&amp;gt; for example:&lt;br&gt;
&amp;gt; airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;gt;  300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;gt;  200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
&amp;gt; ........&lt;br&gt;
&lt;br&gt;
I'm currently thinking about an enhancement of txt2mat &lt;br&gt;
which would involve allowing to completely ignore empty &lt;br&gt;
lines (this would even imply speed benefits). With the &lt;br&gt;
current version on the fex, you'll need some kind of trick &lt;br&gt;
to remove them (see below). &lt;br&gt;
&amp;nbsp;&lt;br&gt;
Just for the sake of completeness: The standard method &lt;br&gt;
would be to directly switch to ReadMode 'line' and sort out &lt;br&gt;
the NaN rows afterwards:&lt;br&gt;
&amp;nbsp;&lt;br&gt;
fn = 'c:\myfile.txt'&lt;br&gt;
&amp;nbsp;&lt;br&gt;
A = txt2mat(fn,0,6,'BadLineString', ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{'air'},'ReadMode','line');&lt;br&gt;
A = A(isfinite(A(:,1)), :);&lt;br&gt;
&amp;nbsp;&lt;br&gt;
Use the 'InfoLevel' parameter to suppress the command line &lt;br&gt;
information about the different row lengths, if you like &lt;br&gt;
(see help).&lt;br&gt;
&amp;nbsp;&lt;br&gt;
Now for the 'trick':&lt;br&gt;
To remove the empty lines in the text, you can also delete &lt;br&gt;
consecutive line break characters by the help of &lt;br&gt;
the 'ReplaceExpr'. On a windows system (!), the character &lt;br&gt;
pair char([13 10]) forms a single line break. If your empty &lt;br&gt;
lines do not contain any whitespace, the occurence of &lt;br&gt;
char([10 13]) indicates a double line break. Hence, use&lt;br&gt;
&amp;nbsp;&lt;br&gt;
B = txt2mat(fn,0,6,'BadLineString',{'air'},...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'ReplaceExpr',{{char([10, 13]),''}});&lt;br&gt;
&amp;nbsp;&lt;br&gt;
Usually, txt2mat expects anything to be manipulated with &lt;br&gt;
the exception of line breaks. As txt2mat cycles throught &lt;br&gt;
the text by sections containing 200'000 lines by default, &lt;br&gt;
the above will only work safely if you have less data lines &lt;br&gt;
+ empty lines than that. Of course, you could get around &lt;br&gt;
that as well (see 'MemPar' argument). If you need further &lt;br&gt;
information, feel free to contact me via the fex form. &lt;br&gt;
Please check which solution is most convenient in terms of &lt;br&gt;
usage and speed on your system.&lt;br&gt;
&amp;nbsp;&lt;br&gt;
Hth,&lt;br&gt;
regards&lt;br&gt;
Andres</description>
    </item>
    <item>
      <pubDate>Mon, 02 Jun 2008 13:25:04 -0400</pubDate>
      <title>Re: about textread</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167664#435414</link>
      <author>Wu Zhiyong</author>
      <description>&quot;Andres &quot; &amp;lt;rantore@werb.de&amp;gt; wrote in message &lt;br&gt;
&amp;lt;g20dkr$aof$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Wu Zhiyong&quot; &amp;lt;wuzhiyong_163@163.com&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;g1u9v6$2i4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; But one more question:&lt;br&gt;
&amp;gt; &amp;gt;   How can I ignore the blank line?&lt;br&gt;
&amp;gt; &amp;gt; for example:&lt;br&gt;
&amp;gt; &amp;gt; airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;gt; &amp;gt;  300.0        38   1.55661   1.83753  2.44242  26&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; airpressure staions  bias      MAE     RMSE    HR&lt;br&gt;
&amp;gt; &amp;gt;  200.0       44   1.82511   2.34681  2.78835  22&lt;br&gt;
&amp;gt; &amp;gt; ........&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I'm currently thinking about an enhancement of txt2mat &lt;br&gt;
&amp;gt; which would involve allowing to completely ignore empty &lt;br&gt;
&amp;gt; lines (this would even imply speed benefits). With the &lt;br&gt;
&amp;gt; current version on the fex, you'll need some kind of &lt;br&gt;
trick &lt;br&gt;
&amp;gt; to remove them (see below). &lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; Just for the sake of completeness: The standard method &lt;br&gt;
&amp;gt; would be to directly switch to ReadMode 'line' and sort &lt;br&gt;
out &lt;br&gt;
&amp;gt; the NaN rows afterwards:&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; fn = 'c:\myfile.txt'&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; A = txt2mat(fn,0,6,'BadLineString', ...&lt;br&gt;
&amp;gt;             {'air'},'ReadMode','line');&lt;br&gt;
&amp;gt; A = A(isfinite(A(:,1)), :);&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; Use the 'InfoLevel' parameter to suppress the command &lt;br&gt;
line &lt;br&gt;
&amp;gt; information about the different row lengths, if you like &lt;br&gt;
&amp;gt; (see help).&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; Now for the 'trick':&lt;br&gt;
&amp;gt; To remove the empty lines in the text, you can also &lt;br&gt;
delete &lt;br&gt;
&amp;gt; consecutive line break characters by the help of &lt;br&gt;
&amp;gt; the 'ReplaceExpr'. On a windows system (!), the &lt;br&gt;
character &lt;br&gt;
&amp;gt; pair char([13 10]) forms a single line break. If your &lt;br&gt;
empty &lt;br&gt;
&amp;gt; lines do not contain any whitespace, the occurence of &lt;br&gt;
&amp;gt; char([10 13]) indicates a double line break. Hence, use&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; B = txt2mat(fn,0,6,'BadLineString',{'air'},...&lt;br&gt;
&amp;gt;             'ReplaceExpr',{{char([10, 13]),''}});&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; Usually, txt2mat expects anything to be manipulated with &lt;br&gt;
&amp;gt; the exception of line breaks. As txt2mat cycles throught &lt;br&gt;
&amp;gt; the text by sections containing 200'000 lines by &lt;br&gt;
default, &lt;br&gt;
&amp;gt; the above will only work safely if you have less data &lt;br&gt;
lines &lt;br&gt;
&amp;gt; + empty lines than that. Of course, you could get around &lt;br&gt;
&amp;gt; that as well (see 'MemPar' argument). If you need &lt;br&gt;
further &lt;br&gt;
&amp;gt; information, feel free to contact me via the fex form. &lt;br&gt;
&amp;gt; Please check which solution is most convenient in terms &lt;br&gt;
of &lt;br&gt;
&amp;gt; usage and speed on your system.&lt;br&gt;
&amp;gt;  &lt;br&gt;
&amp;gt; Hth,&lt;br&gt;
&amp;gt; regards&lt;br&gt;
&amp;gt; Andres&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
I writed a simple Function(10 lines or less) to remove the &lt;br&gt;
NaN lines from the output matrix A.&lt;br&gt;
but absolutely,&quot;isfinite&quot; is conciser.&lt;br&gt;
The progress speeds up with 'InfoLevel' set to be 0.&lt;br&gt;
I'm expecting your enhancement!</description>
    </item>
  </channel>
</rss>

