[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Reading a file
From: |
Pruitt Dave W Contr AEDC/SVT |
Subject: |
RE: Reading a file |
Date: |
Mon, 5 Aug 2002 15:56:50 -0000 |
Thanks, that works very well.
-----Original Message-----
From: Luc Lefebvre [mailto:address@hidden
Sent: Friday, August 02, 2002 2:27 PM
To: Pruitt Dave W Contr AEDC/SVT
Subject: Re: Reading a file
Hi,
Have you tried reading each line as a string (with fgetl for example) and
then doing a split(line,"\t"), providing the data is tab delimited. One
could then convert the third element to an integer str2num.
I had a go at it with the sample below (assuming tab delimited) and it
worked for me.
On Fri, 02 Aug 2002 18:38:26 +0000
Pruitt Dave W Contr AEDC/SVT <address@hidden> wrote:
> Sorry for the dumb question, but I'm stuck.
>
> I need to read a file with records like:
>
> filename1234 11:11 0 A
> filename5678 12:12 0 A
> .
> .
> .
>
> I want to read the first element as a string ( to be used as a filename),
> the second element as a string to be parsed to hours and minutes, the
third
> element as an integer, and the fourth element as a simple character.
>
> I've tried multiple constructions of fscanf and I just can't get it done.
> Not sure what I'm missing in my understanding of fscanf.
>
> Any help would be appreciated.
>
> David W. Pruitt, PhD
> Sverdrup Technology, Inc.
> 939 Avenue C
> Arnold AFB, TN 37389-9900
> address@hidden
> 931-454-3130 (DSN 340-)
> 931-454-4611 FAX
>
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
>
--
Luc Lefebvre o
/`-'
Open Source, a strategic choice \
for mission-critical applications ___/___./
Key fingerprint = D2E5 5E35 B910 6F4E 0242 EC63 0FD9 96D0 C7F4 784E
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Reading a file, Pruitt Dave W Contr AEDC/SVT, 2002/08/02
- RE: Reading a file,
Pruitt Dave W Contr AEDC/SVT <=