Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Omitting certain lines with 'textscan'
Date: Sun, 23 Nov 2008 20:09:02 +0000 (UTC)
Organization: Pierburg GmbH
Lines: 17
Message-ID: <ggcd8u$bcl$1@fred.mathworks.com>
References: <ggcb3h$k5k$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1227470942 11669 172.30.248.35 (23 Nov 2008 20:09:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 23 Nov 2008 20:09:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 872224
Xref: news.mathworks.com comp.soft-sys.matlab:502673


"Ryan Utz" <rutz@al.umces.edu> wrote in message <ggcb3h$k5k$1@fred.mathworks.com>...
> Hi all,
> 
> I'm trying to import a very basic data set that looks like this:
> 
> year month day hour flow
> 1992 2 13 6 18.3
> 
> Sometimes, however, when the data are erroneous the final field (flow) is listed as a negative number. I'd like to just omit any and all data when this is the case, in other words, I don't even want the dates for erroneous data to be imported. Is there a clean way in 'textscan' to specify when to ignore a particular line when it involves just one field? If not, anyone have any post-import ideas?

It looks much easier to me to follow the post-import route...
as an example:
a = [1 2 3
     4 5 -6
     7 8 9];
isOk = a(:,end)>=0;
b = a(isOk,:);