<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807</link>
    <title>MATLAB Central Newsreader - file length</title>
    <description>Feed for thread: file length</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, 03 Jun 2009 14:00:19 -0400</pubDate>
      <title>file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654372</link>
      <author>Dominic </author>
      <description>Hi, &lt;br&gt;
I was wondering if anyone knew of a way to find the length (preferably the number of rows) in a .dat file without having to load it into MATLAB?&lt;br&gt;
Thank you</description>
    </item>
    <item>
      <pubDate>Wed, 03 Jun 2009 15:15:49 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654396</link>
      <author>Lothar Schmidt</author>
      <description>Dominic schrieb:&lt;br&gt;
&amp;gt; Hi, &lt;br&gt;
&amp;gt; I was wondering if anyone knew of a way to find the length (preferably the number of rows) in a .dat file without having to load it into MATLAB?&lt;br&gt;
&amp;gt; Thank you&lt;br&gt;
&lt;br&gt;
number of bytes you can find as follows:&lt;br&gt;
&lt;br&gt;
fileinfo=dir('filename.dat');&lt;br&gt;
fileinfo.size&lt;br&gt;
&lt;br&gt;
difficult to guess the number of row separators without reading the &lt;br&gt;
file... perhaps meanwhile someone has written crystalball.m and put it &lt;br&gt;
in the FEX.&lt;br&gt;
&lt;br&gt;
Lothar</description>
    </item>
    <item>
      <pubDate>Wed, 03 Jun 2009 15:50:17 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654413</link>
      <author>Dominic </author>
      <description>Lothar Schmidt &amp;lt;vapooroop@gmx.net&amp;gt; wrote in message &amp;lt;h06437$kts$1@online.de&amp;gt;...&lt;br&gt;
&amp;gt; Dominic schrieb:&lt;br&gt;
&amp;gt; &amp;gt; Hi, &lt;br&gt;
&amp;gt; &amp;gt; I was wondering if anyone knew of a way to find the length (preferably the number of rows) in a .dat file without having to load it into MATLAB?&lt;br&gt;
&amp;gt; &amp;gt; Thank you&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; number of bytes you can find as follows:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; fileinfo=dir('filename.dat');&lt;br&gt;
&amp;gt; fileinfo.size&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; difficult to guess the number of row separators without reading the &lt;br&gt;
&amp;gt; file... perhaps meanwhile someone has written crystalball.m and put it &lt;br&gt;
&amp;gt; in the FEX.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Lothar&lt;br&gt;
&lt;br&gt;
Is there any way for me to use the number of bytes in the file to deduce the number of data points or something along those lines?</description>
    </item>
    <item>
      <pubDate>Wed, 03 Jun 2009 16:08:01 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654421</link>
      <author>Jan Simon</author>
      <description>Dear Dominic!&lt;br&gt;
&lt;br&gt;
&amp;gt; I was wondering if anyone knew of a way to find the length (preferably the number of rows) in a .dat file without having to load it into MATLAB?&lt;br&gt;
&lt;br&gt;
It depends on what the format of DAT is in your case.&lt;br&gt;
If you create the DAT files by your own, it would be a trivial idea to write the numbers of rows as initial UINT32.&lt;br&gt;
If the DAT file contains numbers in ASCII format, you can read a single line with S=FGETL and look for the number of elements after SSCANF(S, '%f').&lt;br&gt;
Nevertheless, more details about the DAT files must be known to solve the problem.&lt;br&gt;
&lt;br&gt;
Good luck, Jan Simon</description>
    </item>
    <item>
      <pubDate>Wed, 03 Jun 2009 16:37:02 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654431</link>
      <author>Dominic </author>
      <description>&quot;Jan Simon&quot; &amp;lt;matlab.THIS_YEAR@nMINUSsimon.de&amp;gt; wrote in message &amp;lt;h06751$f6f$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Dear Dominic!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I was wondering if anyone knew of a way to find the length (preferably the number of rows) in a .dat file without having to load it into MATLAB?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; It depends on what the format of DAT is in your case.&lt;br&gt;
&amp;gt; If you create the DAT files by your own, it would be a trivial idea to write the numbers of rows as initial UINT32.&lt;br&gt;
&amp;gt; If the DAT file contains numbers in ASCII format, you can read a single line with S=FGETL and look for the number of elements after SSCANF(S, '%f').&lt;br&gt;
&amp;gt; Nevertheless, more details about the DAT files must be known to solve the problem.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Good luck, Jan Simon&lt;br&gt;
&lt;br&gt;
The files are all in ASCII format I believe. I created them using dlmwrite so that is what format the should be in. I am a bit confused as to how I can get the number of elements from sscanf without loading the file into the workspace.&lt;br&gt;
Thank you</description>
    </item>
    <item>
      <pubDate>Wed, 03 Jun 2009 17:46:44 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654448</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;Dominic &quot; &amp;lt;dcg48@cornell.edu&amp;gt; wrote in message &lt;br&gt;
news:h0663p$4te$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; Lothar Schmidt &amp;lt;vapooroop@gmx.net&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;lt;h06437$kts$1@online.de&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; Dominic schrieb:&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; I was wondering if anyone knew of a way to find the length (preferably &lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; the number of rows) in a .dat file without having to load it into &lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; MATLAB?&lt;br&gt;
&amp;gt;&amp;gt; &amp;gt; Thank you&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; number of bytes you can find as follows:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; fileinfo=dir('filename.dat');&lt;br&gt;
&amp;gt;&amp;gt; fileinfo.size&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; difficult to guess the number of row separators without reading the&lt;br&gt;
&amp;gt;&amp;gt; file... perhaps meanwhile someone has written crystalball.m and put it&lt;br&gt;
&amp;gt;&amp;gt; in the FEX.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Lothar&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Is there any way for me to use the number of bytes in the file to deduce &lt;br&gt;
&amp;gt; the number of data points or something along those lines?&lt;br&gt;
&lt;br&gt;
What OS are you using?  If you're on Linux or Solaris (and probably Mac as &lt;br&gt;
well, though I haven't tried it) call out to the system (SYSTEM, DOS, UNIX, &lt;br&gt;
or !) and use the wc system function.  This will give you, among other &lt;br&gt;
information, the newline count for the file.  See &quot;man wc&quot; for more &lt;br&gt;
information.&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com </description>
    </item>
    <item>
      <pubDate>Wed, 03 Jun 2009 17:52:01 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654450</link>
      <author>Dominic </author>
      <description>&quot;Steven Lord&quot; &amp;lt;slord@mathworks.com&amp;gt; wrote in message &amp;lt;h06ctf$er4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;Dominic &quot; &amp;lt;dcg48@cornell.edu&amp;gt; wrote in message &lt;br&gt;
&amp;gt; news:h0663p$4te$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; &amp;gt; Lothar Schmidt &amp;lt;vapooroop@gmx.net&amp;gt; wrote in message &lt;br&gt;
&amp;gt; &amp;gt; &amp;lt;h06437$kts$1@online.de&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Dominic schrieb:&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; &amp;gt; I was wondering if anyone knew of a way to find the length (preferably &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; &amp;gt; the number of rows) in a .dat file without having to load it into &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; &amp;gt; MATLAB?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; &amp;gt; Thank you&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; number of bytes you can find as follows:&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; fileinfo=dir('filename.dat');&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; fileinfo.size&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; difficult to guess the number of row separators without reading the&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; file... perhaps meanwhile someone has written crystalball.m and put it&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; in the FEX.&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Lothar&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Is there any way for me to use the number of bytes in the file to deduce &lt;br&gt;
&amp;gt; &amp;gt; the number of data points or something along those lines?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What OS are you using?  If you're on Linux or Solaris (and probably Mac as &lt;br&gt;
&amp;gt; well, though I haven't tried it) call out to the system (SYSTEM, DOS, UNIX, &lt;br&gt;
&amp;gt; or !) and use the wc system function.  This will give you, among other &lt;br&gt;
&amp;gt; information, the newline count for the file.  See &quot;man wc&quot; for more &lt;br&gt;
&amp;gt; information.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -- &lt;br&gt;
&amp;gt; Steve Lord&lt;br&gt;
&amp;gt; slord@mathworks.com &lt;br&gt;
&amp;gt; &lt;br&gt;
No I'm using Windows</description>
    </item>
    <item>
      <pubDate>Wed, 03 Jun 2009 17:56:39 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654456</link>
      <author>dpb</author>
      <description>Dominic wrote:&lt;br&gt;
&amp;gt; &quot;Steven Lord&quot; &amp;lt;slord@mathworks.com&amp;gt; wrote in message &amp;lt;h06ctf$er4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
...&lt;br&gt;
&amp;gt;&amp;gt; ... use the wc system function.  This will give you, among other &lt;br&gt;
&amp;gt;&amp;gt; information, the newline count for the file.  See &quot;man wc&quot; for more &lt;br&gt;
&amp;gt;&amp;gt; information.&lt;br&gt;
...&lt;br&gt;
&amp;gt; No I'm using Windows&lt;br&gt;
&lt;br&gt;
There are any number of Windows ports--here's one...&lt;br&gt;
&lt;br&gt;
&quot;WordCount is a small freeware Windows 95/98/NT command-line program&lt;br&gt;
that counts characters, words and lines in one or more files -- my&lt;br&gt;
attempt to bring the features of the Unix &quot;WC&quot; utility to Windows....&quot;&lt;br&gt;
&lt;br&gt;
&amp;lt;&lt;a href=&quot;http://www.tawbaware.com/wc.htm&quot;&gt;http://www.tawbaware.com/wc.htm&lt;/a&gt;&amp;gt;&lt;br&gt;
&lt;br&gt;
(google is your friend)&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Wed, 03 Jun 2009 18:33:01 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654465</link>
      <author>Dominic </author>
      <description>dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;h06dme$7ii$1@aioe.org&amp;gt;...&lt;br&gt;
&amp;gt; Dominic wrote:&lt;br&gt;
&amp;gt; &amp;gt; &quot;Steven Lord&quot; &amp;lt;slord@mathworks.com&amp;gt; wrote in message &amp;lt;h06ctf$er4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; ... use the wc system function.  This will give you, among other &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; information, the newline count for the file.  See &quot;man wc&quot; for more &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; information.&lt;br&gt;
&amp;gt; ...&lt;br&gt;
&amp;gt; &amp;gt; No I'm using Windows&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; There are any number of Windows ports--here's one...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;WordCount is a small freeware Windows 95/98/NT command-line program&lt;br&gt;
&amp;gt; that counts characters, words and lines in one or more files -- my&lt;br&gt;
&amp;gt; attempt to bring the features of the Unix &quot;WC&quot; utility to Windows....&quot;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;lt;&lt;a href=&quot;http://www.tawbaware.com/wc.htm&quot;&gt;http://www.tawbaware.com/wc.htm&lt;/a&gt;&amp;gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; (google is your friend)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; --&lt;br&gt;
&lt;br&gt;
I am not familiar with that kind of program. Is it possible to call it in MATLAB? The way my program runs now I am working through an entire folder of .dat files using the dir command and a loop so that I run each file. &lt;br&gt;
Thank you, </description>
    </item>
    <item>
      <pubDate>Wed, 03 Jun 2009 22:15:15 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654519</link>
      <author>dpb</author>
      <description>Dominic wrote:&lt;br&gt;
&amp;gt; dpb &amp;lt;none@non.net&amp;gt; wrote in message &amp;lt;h06dme$7ii$1@aioe.org&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; Dominic wrote:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; &quot;Steven Lord&quot; &amp;lt;slord@mathworks.com&amp;gt; wrote in message&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; &amp;lt;h06ctf$er4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; ...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; ... use the wc system function.  This will give you, among&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; other information, the newline count for the file.  See &quot;man&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; wc&quot; for more information.&lt;br&gt;
&amp;gt;&amp;gt; ...&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; No I'm using Windows&lt;br&gt;
&amp;gt;&amp;gt; There are any number of Windows ports--here's one...&lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; &quot;WordCount is a small freeware Windows 95/98/NT command-line&lt;br&gt;
&amp;gt;&amp;gt; program that counts characters, words and lines in one or more&lt;br&gt;
&amp;gt;&amp;gt; files -- my attempt to bring the features of the Unix &quot;WC&quot; utility&lt;br&gt;
&amp;gt;&amp;gt; to Windows....&quot;&lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; &amp;lt;&lt;a href=&quot;http://www.tawbaware.com/wc.htm&quot;&gt;http://www.tawbaware.com/wc.htm&lt;/a&gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; (google is your friend)&lt;br&gt;
&amp;gt;&amp;gt; &lt;br&gt;
&amp;gt;&amp;gt; --&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am not familiar with that kind of program. Is it possible to call&lt;br&gt;
&amp;gt; it in MATLAB? The way my program runs now I am working through an&lt;br&gt;
&amp;gt; entire folder of .dat files using the dir command and a loop so that&lt;br&gt;
&amp;gt; I run each file. Thank you,&lt;br&gt;
&lt;br&gt;
Just pass the command to the OS as Steve suggested...or, likely you &lt;br&gt;
could simply run the utility directly on the files w/ a wild card and &lt;br&gt;
pipe its output to a file for later use.&lt;br&gt;
&lt;br&gt;
--</description>
    </item>
    <item>
      <pubDate>Wed, 03 Jun 2009 22:54:01 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654526</link>
      <author>Jan Simon</author>
      <description>Dear Dominic!&lt;br&gt;
&lt;br&gt;
&amp;gt; The files are all in ASCII format I believe. I created them using dlmwrite so that is what format the should be in. I am a bit confused as to how I can get the number of elements from sscanf without loading the file into the workspace.&lt;br&gt;
&lt;br&gt;
My suggested FGETL method reads just the first line of the file:&lt;br&gt;
&amp;nbsp;&amp;nbsp;FID = fopen(FileName, 'rb');&lt;br&gt;
&amp;nbsp;&amp;nbsp;Line1 = fgetl(FID);&lt;br&gt;
&amp;nbsp;&amp;nbsp;fclose(FID);&lt;br&gt;
&amp;nbsp;&amp;nbsp;Data = sscanf(Line1);&lt;br&gt;
&amp;nbsp;&amp;nbsp;NumberOfColums = length(Data);&lt;br&gt;
&lt;br&gt;
Nevertheless, if I read your original question, I find, that you want the number of **rows**, not columns...&lt;br&gt;
&lt;br&gt;
Beside the smart WC command, you could try this function in pure Matlab:&lt;br&gt;
&lt;br&gt;
function nRow = CountLines(FileName)&lt;br&gt;
FID = fopen(FileName, 'rb');  % ADD CHECK FOR: FID==-1&lt;br&gt;
nRow = 0;&lt;br&gt;
while ischar(fgets(FID))&lt;br&gt;
&amp;nbsp;&amp;nbsp;nRow = nRow + 1;&lt;br&gt;
end&lt;br&gt;
fclose(FID);&lt;br&gt;
return;&lt;br&gt;
&lt;br&gt;
This is faster than loading the file into the workspace, because the ASCII lines are not parsed from text to doubles.&lt;br&gt;
&lt;br&gt;
Good luck, Jan</description>
    </item>
    <item>
      <pubDate>Thu, 04 Jun 2009 10:51:01 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654615</link>
      <author>Jos </author>
      <description>&quot;Dominic &quot; &amp;lt;dcg48@cornell.edu&amp;gt; wrote in message &amp;lt;h05vlj$csf$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi, &lt;br&gt;
&amp;gt; I was wondering if anyone knew of a way to find the length (preferably the number of rows) in a .dat file without having to load it into MATLAB?&lt;br&gt;
&amp;gt; Thank you&lt;br&gt;
&lt;br&gt;
For ascii files, this might do the job&lt;br&gt;
&lt;br&gt;
Nrows = numel(textread('mydata.txt','%1c%*[^\n]'))&lt;br&gt;
&lt;br&gt;
Note that it does read in some data (temporarily!): one character per non-empty row. &lt;br&gt;
&lt;br&gt;
hth&lt;br&gt;
Jos</description>
    </item>
    <item>
      <pubDate>Thu, 04 Jun 2009 13:02:02 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654649</link>
      <author>Kenneth Eaton</author>
      <description>&quot;Jos &quot; &amp;lt;#10584@fileexchange.com&amp;gt; wrote in message &amp;lt;h088ul$e0s$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; For ascii files, this might do the job&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Nrows = numel(textread('mydata.txt','%1c%*[^\n]'))&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Note that it does read in some data (temporarily!): one character per non-empty row. &lt;br&gt;
&lt;br&gt;
One caveat: This solution won't count empty rows that consist of only a newline character. However, if you know there will always be something in every row, this should work great.&lt;br&gt;
&lt;br&gt;
Note: Newer versions of MATLAB urge the use of TEXTSCAN over TEXTREAD. I'm guessing eventually TEXTREAD will be phased out.</description>
    </item>
    <item>
      <pubDate>Thu, 04 Jun 2009 13:50:18 -0400</pubDate>
      <title>Re: file length</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/252807#654665</link>
      <author>Dominic </author>
      <description>&quot;Kenneth Eaton&quot; &amp;lt;Kenneth.dot.Eaton@cchmc.dot.org&amp;gt; wrote in message &amp;lt;h08gka$aim$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Jos &quot; &amp;lt;#10584@fileexchange.com&amp;gt; wrote in message &amp;lt;h088ul$e0s$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; For ascii files, this might do the job&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Nrows = numel(textread('mydata.txt','%1c%*[^\n]'))&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Note that it does read in some data (temporarily!): one character per non-empty row. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; One caveat: This solution won't count empty rows that consist of only a newline character. However, if you know there will always be something in every row, this should work great.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Note: Newer versions of MATLAB urge the use of TEXTSCAN over TEXTREAD. I'm guessing eventually TEXTREAD will be phased out.&lt;br&gt;
&lt;br&gt;
The function worked great. Thanks!</description>
    </item>
  </channel>
</rss>

