[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fscanf
From: |
John W. Eaton |
Subject: |
Re: fscanf |
Date: |
Wed, 14 Apr 1999 12:48:27 -0500 (CDT) |
On 14-Apr-1999, Joao Cardoso <address@hidden> wrote:
| Thomas Walter wrote:
| >
| > >>>>> "Joao" == Joao Cardoso <address@hidden> writes:
| >
| > Joao> Thomas Walter wrote:
| > >>
| > >> Hello,
| > >> is it only me who has problems with 'fscanf' and friends?
| > >>
| > >> I have measured data in a data file written as ASCII, i.e.:
| > >> 10 123.4
| > >> 20 234.5
| > >> 30 345.6
| > >> 40 456.7
| > >> 50 567.8
| > >> 60 678.9
| > >>
| > >> This is data in one line belongs together. In this case I have 2
| > >> columns and the number of lines/rows is unknown, bu defined by EOF.
| > >> If I read the data with this knowledge I always jump into the same
| > >> pit. The 'fscanf' function wants lines and colomuns in the opposited
| > >> order.
| > >>
| > >> Apart from that the matrix I get has the size 2x6, this means:
| > >> 10 20 30 40 50 60
| > >> 123.4 234.5 345.6 456.7 567.8 678.9
| > >>
| > >> Is this behaviour only strange for me?
|
| It seems that the doc is not updated.
Yes, the bug is in the docs. It should read:
[A, COUNT] = fscanf (FILENUM, FORMAT [, SIZE])
Read from FILENUM according to FORMAT, returning the result in the
matrix A. SIZE is optional. If present, it can be one of
Inf : read as much as possible, returning a column vector
(unless doing all character conversions, in which case a
string is returned)
NR : read up to NR elements, returning a column vector
[NR, NC] : read up to NR x NC elements, returning a matrix with NR rows
[NR, Inf] : read as much as possible, returning a matrix with NR rows
If it is omitted, a value of Inf is assumed.
The number of items successfully read is returned in COUNT.
[A, B, ...] = fscanf (FILENUM, FORMAT, "C")
Read from FILENUM according to FORMAT, with each conversion specifier
in FORMAT corresponding to a single scalar return value. This form is
more `C-like', and also compatible with previous versions of Octave
Thanks,
jwe
- fscanf, Thomas Walter, 1999/04/13