Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!d55g2000hsg.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 18:58:00 -0000
Organization: http://groups.google.com
Lines: 82
Message-ID: <1183834680.449738.237570@d55g2000hsg.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 1183834680 5622 127.0.0.1 (7 Jul 2007 18:58:00 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 7 Jul 2007 18:58:00 +0000 (UTC)
In-Reply-To: <ef5cbda.4@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: d55g2000hsg.googlegroups.com; posting-host=80.6.89.170;
Xref: news.mathworks.com comp.soft-sys.matlab:417767



On Jul 7, 7:54 pm, "per isakson" <p...@kth2.se> wrote:
> muhdzubair wrote:
>
> > On Jul 7, 7:16 pm, "per isakson" <p...@kth2.se> wrote:
> >> muhdzubair wrote:
>
> >> > On Jul 7, 6:42 pm, "per isakson" <p...@kth2.se>
> wrote:
> >> >> muhdzubair wrote:
>
> >> >> > Hi,
> >> >> > I want to read the 8th column from the file
> below:
>
> >> >> > 52.0 277 177 133 179 105 81 612999 320000
> >> >> > 147379
> >> >> > 154795 1238
> >> >> > 53.0 277 177 133 180 105 81 601314 317429
> >> >> > 146368
> >> >> > 153743 1232
> >> >> > 54.0 276 177 132 181 105 81 589799 314805
> >> >> > 145321
> >> >> > 152652 1227
> >> >> > 55.0 276 177 131 181 105 81 578469 312132
> >> >> > 144237
> >> >> > 151521 1221
>
> >> >> > I tried to use 'textscan' but couldnt get the
> result..can
> >> > anyone
> >> >> > help
> >> >> > me to read the 8th column and sore in a variable
> for this
> >> >> > particular
> >> >> > case..
> >> >> > Thanks
>
> >> >> textscan( fid, '%*f%*f%*f%*f%*f%*f%*f%f%*f%*f%*f', ...
> )
>
> >> >> should do it / per- Hide quoted text -
>
> >> >> - Show quoted text -
>
> >> > I used textscan :
> >> > c=textscan(fid,'%*f %*f %*f %*f %*f %*f %*f %f');
>
> >> > but the output is:
> >> > c=
> >> > [18x1 double]
>
> >> > can i get the entire column as i have to get sum of all
> the
> > four
> >> > numbers in the said column..
>
> >> How many line are there in the file? / per- Hide quoted text -
>
> >> - Show quoted text -
>
> > At the moment there are 12 columns and 9 rows in the file...
>
> try
>
> c=textscan(fid,'%*f %*f %*f %*f %*f %*f %*f %f %*f %*f %*f %*f');
>
> all twelve columns must be accounted for in the format string.
>
> / per- Hide quoted text -
>
> - Show quoted text -

Thanks Per, i read the column successfully...its wonderful..
one more thing, the file which i read i formatted it but the original
file has some strings above and below the numerical data(rows and
cols)...in the presence of those strings the file cant be read by the
said command and it gives the result:
C =

    {[]}
which is a 1 by 0 matrix... how can i read it now..