Re: Fortran 77: read second number on a line in a comma delimited text file
- From: GaryScott <garylscott@xxxxxxxxxxxxx>
- Date: Mon, 9 Feb 2009 12:28:45 -0800 (PST)
On Feb 9, 11:41 am, dpb <n...@xxxxxxx> wrote:
...> Is there a way to use format directed input in fortran 77 to read the
second number of each line in a comma delimited text file (.csv file)
A more general musing after the previous response of a specific FORMAT
solution that has many limitations...
I suppose the idea of an "elegant" solution would be a FORMAT positional
specifier that is context-sensitive (for lack of better phraseology that
comes to mind at the moment) that would allow for skipping a
Matlab (ML) has such a feature in some of its text input functions. ML
uses a (vectorized) form of the C printf() format descriptors. In the
function such as textread() which has quite a few options for handling
variously formatted text files, using %* instead of % in a conversion
causes textread() to skip the matching characters in the input and no
output is created for this conversion. It also has a selectable field
delimiter character, so a csv file can be parsed by column in a single call.
Of course, all of this is implemented in a fairly complex routine that
does all the parsing of the input file so underneath the surface the
duck is paddling furiously although it looks quite serene from shore.
There once was a proposal for options csv file reading in F2k8...I
think maybe it went away.
- Prev by Date: Re: Write position
- Next by Date: Re: Write position
- Previous by thread: Re: Fortran 77: read second number on a line in a comma delimited text file
- Next by thread: Re: Fortran 77: read second number on a line in a comma delimited text file