Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!postnews.google.com!i20g2000prf.googlegroups.com!not-for-mail
From: NZTideMan <mulgor@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Omitting certain lines with 'textscan'
Date: Sun, 23 Nov 2008 12:06:06 -0800 (PST)
Organization: http://groups.google.com
Lines: 30
Message-ID: <0927bd79-87d0-4f16-b356-8b5bcdaf70a6@i20g2000prf.googlegroups.com>
References: <ggcb3h$k5k$1@fred.mathworks.com>
NNTP-Posting-Host: 202.78.152.105
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1227470767 11089 127.0.0.1 (23 Nov 2008 20:06:07 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sun, 23 Nov 2008 20:06:07 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: i20g2000prf.googlegroups.com; posting-host=202.78.152.105; 
	posting-account=qPexFwkAAABOl8VUndE6Jm-9Z5z_fSpR
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon; 
	Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 
	1.1.4322),gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 nc2 (NetCache NetApp/6.0.5P1)
Xref: news.mathworks.com comp.soft-sys.matlab:502671


On Nov 24, 8:32=A0am, "Ryan Utz" <r...@al.umces.edu> wrote:
> 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 t=
his 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 ha=
ve any post-import ideas?
>
> Thanks,
> Ryan

Think about it.
How would textscan (or any routine) know if the number was negative
unless it read it in?
The best way is to read everything in, then post process the data by
finding the addresses of the negative flows:
indx=3DQ<0;
or
indx=3Dfind(Q<0);
Then you can eliminate those rows:
Q(indx)=3D[];
year(indx)=3D[];
etc