Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!news.glorb.com!postnews.google.com!c77g2000hse.googlegroups.com!not-for-mail
From:  muhdzubair@gmail.com
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to read a particular line
Date: Sat, 07 Jul 2007 21:01:14 -0000
Organization: http://groups.google.com
Lines: 32
Message-ID: <1183842074.669395.184660@c77g2000hse.googlegroups.com>
References: <1183831715.608443.62780@n2g2000hse.googlegroups.com>
NNTP-Posting-Host: 80.6.89.170
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Trace: posting.google.com 1183842074 26970 127.0.0.1 (7 Jul 2007 21:01:14 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 7 Jul 2007 21:01:14 +0000 (UTC)
In-Reply-To: <ef5cbda.8@webcrossing.raydaftYaTP>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506),gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 MPWBSRV
Complaints-To: groups-abuse@google.com
Injection-Info: c77g2000hse.googlegroups.com; posting-host=80.6.89.170;
Xref: news.mathworks.com comp.soft-sys.matlab:417786



On Jul 7, 8:21 pm, us <u...@neurol.unizh.ch> wrote:
> muhdzubair:
> <SNIP everlasting oh-i-forgot-to-tell-you tedium...
>
> > ur piece of code is giving error at 'textread...'
> > as soon as i get strings in the file which are the headings f the
>
> columns, i am unable to read the data...
>
> well, why did you not say so earlier!? instead of wasting CSSM's
> time...
> as i said:
> % assume <foo.txt> is YOUR ascii-file (assuming with the
> % anatomy as posted in the OP...
>
> now, if you have headerlines, use the additional option
>
>      nhdr=2; % # of headers
>      n=textread(fnam,'%n','headerlines',nhdr);
> % rest of snippet
>
> us

i used ur piece of code but it gives few errors which i cudnt
remove... i used the following commands which works only for numbers
and output an empty matrix when there are headers in the file..

fid=fopen('foo.txt');
c=textscan(fid,'%*f %*f %*f %*f %*f %*f %*f %f %*f %*f %*f %*f',
9,'headerLines',2); % bcoz there are two headers
fclose(fid);