Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: how to read text file row/column info
Date: Sat, 15 Mar 2008 04:30:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 21
Message-ID: <frfjcc$it5$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1205555404 19365 172.30.248.38 (15 Mar 2008 04:30:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 15 Mar 2008 04:30:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1316757
Xref: news.mathworks.com comp.soft-sys.matlab:457354



Hi,
I am trying to read a large .txt file with 5 columns and 
over 12000 rows of data.  I'm having trouble getting the 
(row, column) numbers right.  The code looks like this;

loop = 0;
for i = 1:2
    line1 = fgets(fid);
end
while feof(fid) == 0
    loop = loop+1;
    line1 = fgets(fid);
    mass_prop(loop).name = line1(1, 1: 66);
    mass_prop(loop).matl = line1(1,67: 102);
    mass_prop(loop).volm = line1(1,103: 119);
    mass_prop(loop).dens = line1(1,120:133);
    mass_prop(loop).wght = line1(1,134:149);
end

Can anyone help?
Thanks.