Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!r34g2000hsd.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:54:13 -0000
Organization: http://groups.google.com
Lines: 33
Message-ID: <1183845253.870162.4790@r34g2000hsd.googlegroups.com>
References: <1183835610.503422.146760@22g2000hsm.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 1183845254 25719 127.0.0.1 (7 Jul 2007 21:54:14 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 7 Jul 2007 21:54:14 +0000 (UTC)
In-Reply-To: <ef5cbda.12@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: r34g2000hsd.googlegroups.com; posting-host=80.6.89.170;
Xref: news.mathworks.com comp.soft-sys.matlab:417793



On Jul 7, 10:46 pm, us <u...@neurol.unizh.ch> wrote:
> muhdzubair:
> <SNIP a bit stubborn...
>
>
>
> > Error is in the line:
> > n=reshape(n,nc,[]).';
> > "Product of known dimensions, 12, not divisible into total number
> of elements, 1".
> > I am using the following command:
> > n=textscan(fid,'%f','headerlines',hdr); %where hdr=2
>
> note: i did NOT use <textscan>, i used <textread>...
> please, try the snippet i showed you <as is> with your file
> name...
> then: report CSSM this
>
>      whos n % if(f) you still get the error...
>
> us

well, ur code worked perfectly without headers but wid headers its not
working even using 'textread' and gives error in textread, hav a look
at the code pl:
     fid= fopen('foo.txt');
    hdr=2;
     nc=12; % your # of cols
     ec=8; % col to be extracted
     n=textread(fid,'%n','headerlines',hdr);
     k=reshape(n,nc,[]).';
     m=k(:,ec); % the 8th col