Path: news.mathworks.com!not-for-mail
From: "Apurva Dave" <|remove.this|apurva.dave|remove.this|@duke.edu>
Newsgroups: comp.soft-sys.matlab
Subject: quick question about 'textscan'
Date: Mon, 14 Sep 2009 17:15:06 +0000 (UTC)
Organization: Division of Earth and Ocean Sciences
Lines: 19
Message-ID: <h8ltmq$7hq$1@fred.mathworks.com>
Reply-To: "Apurva Dave" <|remove.this|apurva.dave|remove.this|@duke.edu>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1252948506 7738 172.30.248.37 (14 Sep 2009 17:15:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 14 Sep 2009 17:15:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1137547
Xref: news.mathworks.com comp.soft-sys.matlab:570314


Hi,

I'm using textscan to read some tab-delimited data. I want to ignore the metadata as well as some comments. I'm using the following syntax, but I'm getting an 'unknown option' error when I try to use 'commentstyle':

fid = fopen('P980413A.DAT');

textfile = textscan(fid, '%f', 28, 'delimiter','	', ...
	'commentstyle', {'/begin_header /end_header@'}, ...
	'commentstyle', '/begin_data', ...
	'commentstyle', '/end_data@');

fclose(fid);

As far as I can tell, I've entered it all correctly. Parameters are not case-sensitive, although I also tried different versions just to check. Is this a bug in the matlab? I tried restarting. 

'headerlines' isn't a good alternative for me, b/c the metadata for each data file aren't uniform. In any case I still need to find a way to ignore comments interspersed through the file. Any thoughts?

Thanks,
Apurva