The documentation of Asymptote says that it can read data contained in csv files.

The example from the homepage of asymptote contains an explicit example to do this. The corresponding raw data file is here. However, I have some data-files where the separator between columns are just blank-spaces rather than commas.

Presumably just the line file in=input(data).line().csv(); from the above linked code sample has to be tweaked to enable this? I can't seem to find the documentation of the .line() and .csv() functions in the documentation.

  • 1
    From the asy docs (asymptote.pdf, v.2.49, p.75): "...there is a white-space delimiter mode for reading strings, file word(bool b=true), which causes string reads to respect white-space delimiters, instead of the default end-of-line delimiter:" file fin=input("test.txt").line().word(); real[] A=fin; – g.kov Apr 14 at 9:16
  • What kind of data are you reading? For reading data into a numerical array, I believe it is default to use space as the column separator; csv() changes this from space to comma (although it is a bigger effect when you are reading string data). – Charles Staats May 16 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.