Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!22g2000hsm.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 19:13:30 -0000
Organization: http://groups.google.com
Lines: 29
Message-ID: <1183835610.503422.146760@22g2000hsm.googlegroups.com>
References: <1183826686.296756.96900@57g2000hsv.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 1183835610 31582 127.0.0.1 (7 Jul 2007 19:13:30 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 7 Jul 2007 19:13:30 +0000 (UTC)
In-Reply-To: <ef5cbda.6@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: 22g2000hsm.googlegroups.com; posting-host=80.6.89.170;
Xref: news.mathworks.com comp.soft-sys.matlab:417770



On Jul 7, 8:04 pm, us <u...@neurol.unizh.ch> wrote:
> muhdzubair:
> <SNIP reading numbers from ascii file evergreen...
>
> > At the moment there are 12 columns and 9 rows in the file...
>
> one of the many solutions
>
> % assume <foo.txt> is your ascii file
>
>      fnam='foo.txt'; % your file
>      nc=12; % your # of cols
>      ec=8; % col to be extracted
>      n=textread(fnam,'%n');
>      n=reshape(n,nc,[]).';
>      m=n(:,ec); % the 8th col
> % the result
>      type(fnam);
>      n
>      m
>
> us

Dear us
ur piece of code is giving error at 'textread...'....i can read the
particular column using textscan command only when i have only numbers
in the file....as soon as i get strings in the file which are the
headings f the columns, i am unable to read the data..