Thread Subject: How to read a particular line

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 16:44:46

Message: 1 of 24

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

Subject: How to read a particular line

From: per isakson

Date: 7 Jul, 2007 13:42:28

Message: 2 of 24

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

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 18:08:35

Message: 3 of 24

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..

Subject: How to read a particular line

From: per isakson

Date: 7 Jul, 2007 14:16:14

Message: 4 of 24

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

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 18:23:33

Message: 5 of 24

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...

Subject: How to read a particular line

From: per isakson

Date: 7 Jul, 2007 14:54:47

Message: 6 of 24

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

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 18:58:00

Message: 7 of 24

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..

Subject: How to read a particular line

From: us

Date: 7 Jul, 2007 15:04:12

Message: 8 of 24

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

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 19:13:30

Message: 9 of 24

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..

Subject: How to read a particular line

From: us

Date: 7 Jul, 2007 15:21:51

Message: 10 of 24

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

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 21:01:14

Message: 11 of 24

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);

Subject: How to read a particular line

From: us

Date: 7 Jul, 2007 17:17:44

Message: 12 of 24

muhdzubair:
<SNIP lousy procrastinating posting...

> i used ur piece of code but it gives few errors which i cudnt
remove...

WHAT(!) are the <few errors>...

us

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 21:32:50

Message: 13 of 24

On Jul 7, 10:17 pm, us <u...@neurol.unizh.ch> wrote:
> muhdzubair:
> <SNIP lousy procrastinating posting...
>
> > i used ur piece of code but it gives few errors which i cudnt
>
> remove...
>
> WHAT(!) are the <few errors>...
>
> us

Error is in the line:
 n=reshape(n,nc,[]).';
and the error is:
"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

Subject: How to read a particular line

From: us

Date: 7 Jul, 2007 17:46:52

Message: 14 of 24

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

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 21:54:13

Message: 15 of 24

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

Subject: How to read a particular line

From: us

Date: 7 Jul, 2007 18:06:02

Message: 16 of 24

muhdzubair:
<SNIP a simple conundrum...

> fid= fopen('foo.txt');
> n=textread(fid,'%n','headerlines',hdr);

well, for one: you don't need to open the file if you're using
<textread>...
just do

     type foo.txt
% and show the output

% then type
     n=textread('foo.txt',<...>)
% then report
     whos n

us

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 22:17:14

Message: 17 of 24

On Jul 7, 11:06 pm, us <u...@neurol.unizh.ch> wrote:
> muhdzubair:
> <SNIP a simple conundrum...
>
> > fid= fopen('foo.txt');
> > n=textread(fid,'%n','headerlines',hdr);
>
> well, for one: you don't need to open the file if you're using
> <textread>...
> just do
>
> type foo.txt
> % and show the output
>
> % then type
> n=textread('foo.txt',<...>)
> % then report
> whos n
>
> us

still i get errors...i thin u shud see the file and read it urself...
following is the file:



LATI PEAK ALTITUDES IN KM PEAK DENSITIES IN CM-3
GEOD HMF2 h0.5 B0 HMF1 HME HMD NMF2 NMF1 NVBot NME

  52.0 341 281 79 0 105 88 154845 0 592 3090 400
  53.0 342 282 79 0 105 88 152400 0 592 3090 400
  54.0 343 283 80 0 105 88 150444 0 591 3090 400
  55.0 345 284 80 0 105 88 148955 0 591 3090 400
  56.0 346 285 81 0 105 88 147911 0 591 3090 400
  57.0 347 286 81 0 105 88 147293 0 590 3090 400
  58.0 348 286 81 0 105 88 147082 0 590 3090 400
  59.0 349 287 82 0 105 88 147258 0 590 3090 400
  60.0 350 288 82 0 105 88 147804 0 589 3090 400

---CCIR --B0Gul-------------------URSI ------------------------------
LAT/LON= 60.0/ 1.1 H=0.0 RZ12=100.0 MMDD: 110 LT: 2.0 SZA=137.0
MLA/MLO= 61.8/ 91.3 DIP=72.2 F10.7=145.4 DDD: 10 UT: 1.9 SDE=-21.9
--------------------------------------------------------------------

i only want to read any particular column suppose 8th col of integers
and do not want to read the headers and the last four lines of text...
plz write down the cmds n proper format

Subject: How to read a particular line

From: us

Date: 7 Jul, 2007 18:56:38

Message: 18 of 24

muhdzubair:
<SNIP showing some cognitive problems... sorry, cannot help!

well, NOW you FINALLY (and sort of by the way) tell CSSM that your
file also has some trailing stuff at its end!
naturally, none of the proposed solutions will work...

now, if we put your file's contents - copy/paste EXACTLY as you've
shown! - into a file <foo.txt>, one might consider this

% the specs
     fnam='foo.txt';
     ec=8;
     nhdr=3; % !!!!!
% the engine
     n=textread(fnam,'%s',...
               'headerlines',nhdr,...
               'delimiter','\n');
     ix=strmatch('-',n(:,1));
     n=n(1:ix(1)-2,:);
     n=cellfun(@(x) strread(x,'%n'),n,'uni',false);
     n=[n{:}].';
     m=n(:,ec);
% the result
     type(fnam)
     n
     m

us

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 23:05:24

Message: 19 of 24

On Jul 7, 11:56 pm, us <u...@neurol.unizh.ch> wrote:
> muhdzubair:
> <SNIP showing some cognitive problems... sorry, cannot help!
>
> well, NOW you FINALLY (and sort of by the way) tell CSSM that your
> file also has some trailing stuff at its end!
> naturally, none of the proposed solutions will work...
>
> now, if we put your file's contents - copy/paste EXACTLY as you've
> shown! - into a file <foo.txt>, one might consider this
>
> % the specs
> fnam='foo.txt';
> ec=8;
> nhdr=3; % !!!!!
> % the engine
> n=textread(fnam,'%s',...
> 'headerlines',nhdr,...
> 'delimiter','\n');
> ix=strmatch('-',n(:,1));
> n=n(1:ix(1)-2,:);
> n=cellfun(@(x) strread(x,'%n'),n,'uni',false);
> n=[n{:}].';
> m=n(:,ec);
> % the result
> type(fnam)
> n
> m
>
> us

still not working...i thnk i shall work on it tomorrow...sleepy at the
moment...thx for ur discussion and help

Subject: How to read a particular line

From: us

Date: 7 Jul, 2007 19:19:25

Message: 20 of 24

muhdzubair:
<SNIP final showdown...

> still not working...

ok, using the code snippet proposed in the last post, this shows up
here (using your file's contents):

% the specs
     fnam='foo.txt';
     ec=8;
     nhdr=3; % !!!!!
% the engine
     n=textread(fnam,'%s',...
               'headerlines',nhdr,...
               'delimiter','\n');
     ix=strmatch('-',n(:,1));
     n=n(1:ix(1)-2,:);
     n=cellfun(@(x) strread(x,'%n'),n,'uni',false);
     n=[n{:}].';
     m=n(:,ec);
% the result
     type(fnam)
     n
     m

% THE OUTPUT (look at it in the <view original format>!
% ***** FILE BEGIN *****
LATI PEAK ALTITUDES IN KM PEAK DENSITIES IN CM-3
GEOD HMF2 h0.5 B0 HMF1 HME HMD NMF2 NMF1 NVBot NME

  52.0 341 281 79 0 105 88 154845 0 592 3090 400
  53.0 342 282 79 0 105 88 152400 0 592 3090 400
  54.0 343 283 80 0 105 88 150444 0 591 3090 400
  55.0 345 284 80 0 105 88 148955 0 591 3090 400
  56.0 346 285 81 0 105 88 147911 0 591 3090 400
  57.0 347 286 81 0 105 88 147293 0 590 3090 400
  58.0 348 286 81 0 105 88 147082 0 590 3090 400
  59.0 349 287 82 0 105 88 147258 0 590 3090 400
  60.0 350 288 82 0 105 88 147804 0 589 3090 400

---CCIR --B0Gul-------------------URSI ------------------------------
LAT/LON= 60.0/ 1.1 H=0.0 RZ12=100.0 MMDD: 110 LT: 2.0 SZA=137.0
MLA/MLO= 61.8/ 91.3 DIP=72.2 F10.7=145.4 DDD: 10 UT: 1.9 SDE=-21.9
--------------------------------------------------------------------
% ***** FILE END *****

n =
     52 341 281 79 0 105 88 154845 0 592 3090 400
     53 342 282 79 0 105 88 152400 0 592 3090 400
     54 343 283 80 0 105 88 150444 0 591 3090 400
     55 345 284 80 0 105 88 148955 0 591 3090 400
     56 346 285 81 0 105 88 147911 0 591 3090 400
     57 347 286 81 0 105 88 147293 0 590 3090 400
     58 348 286 81 0 105 88 147082 0 590 3090 400
     59 349 287 82 0 105 88 147258 0 590 3090 400
     60 350 288 82 0 105 88 147804 0 589 3090 400

m =
     154845
     152400
     150444
     148955
     147911
     147293
     147082
     147258
     147804

this mirrors EXACTLY the data in your file; so, what do you
get/want...

us

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 23:41:05

Message: 21 of 24

On Jul 8, 12:19 am, us <u...@neurol.unizh.ch> wrote:
> muhdzubair:
> <SNIP final showdown...
>
> > still not working...
>
> ok, using the code snippet proposed in the last post, this shows up
> here (using your file's contents):
>
> % the specs
> fnam='foo.txt';
> ec=8;
> nhdr=3; % !!!!!
> % the engine
> n=textread(fnam,'%s',...
> 'headerlines',nhdr,...
> 'delimiter','\n');
> ix=strmatch('-',n(:,1));
> n=n(1:ix(1)-2,:);
> n=cellfun(@(x) strread(x,'%n'),n,'uni',false);
> n=[n{:}].';
> m=n(:,ec);
> % the result
> type(fnam)
> n
> m
>
> % THE OUTPUT (look at it in the <view original format>!
> % ***** FILE BEGIN *****
> LATI PEAK ALTITUDES IN KM PEAK DENSITIES IN CM-3
> GEOD HMF2 h0.5 B0 HMF1 HME HMD NMF2 NMF1 NVBot NME
>
> 52.0 341 281 79 0 105 88 154845 0 592 3090 400
> 53.0 342 282 79 0 105 88 152400 0 592 3090 400
> 54.0 343 283 80 0 105 88 150444 0 591 3090 400
> 55.0 345 284 80 0 105 88 148955 0 591 3090 400
> 56.0 346 285 81 0 105 88 147911 0 591 3090 400
> 57.0 347 286 81 0 105 88 147293 0 590 3090 400
> 58.0 348 286 81 0 105 88 147082 0 590 3090 400
> 59.0 349 287 82 0 105 88 147258 0 590 3090 400
> 60.0 350 288 82 0 105 88 147804 0 589 3090 400
>
> ---CCIR --B0Gul-------------------URSI ------------------------------
> LAT/LON= 60.0/ 1.1 H=0.0 RZ12=100.0 MMDD: 110 LT: 2.0 SZA=137.0
> MLA/MLO= 61.8/ 91.3 DIP=72.2 F10.7=145.4 DDD: 10 UT: 1.9 SDE=-21.9
> --------------------------------------------------------------------
> % ***** FILE END *****
>
> n =
> 52 341 281 79 0 105 88 154845 0 592 3090 400
> 53 342 282 79 0 105 88 152400 0 592 3090 400
> 54 343 283 80 0 105 88 150444 0 591 3090 400
> 55 345 284 80 0 105 88 148955 0 591 3090 400
> 56 346 285 81 0 105 88 147911 0 591 3090 400
> 57 347 286 81 0 105 88 147293 0 590 3090 400
> 58 348 286 81 0 105 88 147082 0 590 3090 400
> 59 349 287 82 0 105 88 147258 0 590 3090 400
> 60 350 288 82 0 105 88 147804 0 589 3090 400
>
> m =
> 154845
> 152400
> 150444
> 148955
> 147911
> 147293
> 147082
> 147258
> 147804
>
> this mirrors EXACTLY the data in your file; so, what do you
> get/want...
>
> us

i m still getting error using exactly ur code... the erroe is in the
line:
n=cellfun(@(x) strread(x,'%n'),n,'uni',false)
and the error is:
Too many inputs.

Subject: How to read a particular line

From: us

Date: 7 Jul, 2007 19:48:05

Message: 22 of 24

muhdzubair:
<SNIP very bad news...

> the erroe is in the line:
> n=cellfun(@(x) strread(x,'%n'),n,'uni',false)
> and the error is:
> Too many inputs...

very, very bad news, indeed...
you're obviously running an older ML version; what's your output of

     version

can you upgrade?

us

Subject: How to read a particular line

From: muhdzubair@gmail.com

Date: 7 Jul, 2007 23:50:24

Message: 23 of 24

On Jul 8, 12:48 am, us <u...@neurol.unizh.ch> wrote:
> muhdzubair:
> <SNIP very bad news...
>
> > the erroe is in the line:
> > n=cellfun(@(x) strread(x,'%n'),n,'uni',false)
> > and the error is:
> > Too many inputs...
>
> very, very bad news, indeed...
> you're obviously running an older ML version; what's your output of
>
> version
>
> can you upgrade?
>
> us

i m using MATLAB 7.0.... which is latest i guess

Subject: How to read a particular line

From: us

Date: 7 Jul, 2007 20:02:16

Message: 24 of 24

muhdzubair:
<SNIP ways behind...

> i m using MATLAB 7.0.... which is latest i guess...

unfortunately: no; the latest is

     version
% ans = 7.4.0.287 (R2007a)

the new <cellfun> functionality, which the snippet uses, was
introduced in version 7.1
again, can you upgrade?
otherwise, you'd have to replace the simple <cellfun> command
with a (simple) for-loop...

us

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
evergreen us 30 Jan, 2008 20:25:26
import Matthew Simoneau 11 Jul, 2007 13:38:56
io Matthew Simoneau 11 Jul, 2007 13:38:51
textscan Matthew Simoneau 11 Jul, 2007 13:38:51
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com