Path: news.mathworks.com!newsfeed-00.mathworks.com!news.kjsl.com!newsfeed.stanford.edu!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: Delete single line using textscan
Date: Fri, 1 Aug 2008 20:54:12 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 26
Message-ID: <g6vt5k$mi8$1@canopus.cc.umanitoba.ca>
References: <g6vscv$91j$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1217624052 23112 192.70.172.160 (1 Aug 2008 20:54:12 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Fri, 1 Aug 2008 20:54:12 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:483205



In article <g6vscv$91j$1@fred.mathworks.com>,
David Reed <dreed@mitre.org> wrote:
>I want to use textscan to bring in a whole bunch of data,
>almost 50000 lines of it.  Everything is formatted nicely
>except for a few lines here and there.  

>I need a way for text scan to not read these lines.  The
>problem is that they start like the others so I can't use
>commentstyle.  

>Does anyone have any ideas.  Thanks

If you know exact line numbers, use counts on the textscan()
to read up to that point, then fgetl() to read the next
line (and discard it), then textscan() as much more as you can, etc..

If you don't know exact line numbers and can only tell by the
different formatting, you can either process a line at a time
(using fgetl to get the line and then one of the several parsing
routines), or you can read the entire file at once as a string,
delete the lines that give the problems, then textscan() the
string variable. (You can put a string in, in place of a fid).

-- 
   "I was very young in those days, but I was also rather dim."
   -- Christopher Priest