Re: Fortran 77: read second number on a line in a comma delimited text file



On Feb 9, 11:41 am, dpb <n...@xxxxxxx> wrote:
kilter 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
variable-width field.

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



Relevant Pages

  • Re: Need performance help
    ... Monitor utility output to Comma Separated Value format files. ... At least one CSV file must be specified. ... the matching parameters from all the files are shown on the same chart. ... specify the commands on the command line. ...
    (comp.os.vms)
  • Re: Re: Actual solution
    ... It will import into excel as text. ... Selecting the cell shows that it's already correctly formatted. ... No calculation has been performed and the data and the value in the CSV file ... What if you format ...
    (microsoft.public.excel)
  • Re: Fortran 77: read second number on a line in a comma delimited text file
    ... I suppose the idea of an "elegant" solution would be a FORMAT positional specifier that is context-sensitive that would allow for skipping a variable-width field. ... In the function such as textreadwhich has quite a few options for handling variously formatted text files, using %* instead of % in a conversion causes textreadto 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. ...
    (comp.lang.fortran)
  • Re: Passing FieldInfo Array from VBS to objExcel.OpenText
    ... The .csv file is comma delimited, text is enclosed in double quotes, dates ... are in format dd-mm-yyyy. ... I am Dutch and Excel on our server is configured to semicolon as field ... xlGeneralFormat), Array(4, xlTextFormat), Array, Array(6, ...
    (microsoft.public.scripting.vbscript)
  • Re: date format changes when I save to CSV via a macro
    ... So it looked like the formatted text was saved in the .CSV file. ... But the problem occurs when I try to bring that data back into excel. ... a date according to my windows short date format. ... When the data is pasted across into the macro workbook, ...
    (microsoft.public.excel.misc)