MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Importing CSV (comma separated values) files?

  • To: mathgroup at
  • Subject: [mg13769] Re: Importing CSV (comma separated values) files?
  • From: "P.J. Hinton" <paulh>
  • Date: Mon, 24 Aug 1998 05:07:18 -0400
  • Organization: "Wolfram Research, Inc."
  • References: <6rdn5h$>
  • Sender: owner-wri-mathgroup at

On 19 Aug 1998, Joe Gwinn wrote:

> I have been trying to convince Mathematica 3.0.1 to ReadList an ordinary
> CSV spreadsheet file, without luck.  It finds the file OK, then
> complains of an unspecified "syntax error" while reading a number.  No
> useful information is presented; all one knows is that it failed.
> The file contains 240 lines, each line containing 240 non-negative
> integer values separated by commas.  There are no decimal points or
> plus/minus signs.  The values range fom 0 to 255.  For the record, this
> is an output file from a CCD instrumentation TV camera used to measure
> fiber optic nearfield flux distributions.
> I have played with various combinations of RecordLists, WordSeparators,
> and Number, to no avail.
> Even though 240x240= 57,600 entries, Mathematica was not out of memory. 
> The kernel has 25 MB, and the Front End has 10 MB, and the two
> memory-use thermometers were less than 25% full.  If I take the same
> file and edit it into Mathematica nested-list format and turn it into a
> Mathematica notebook, Mathematica handles the data quite well, so the
> problem is purely with the import function.
> The actual output follows:
> raw2Ddata = 
>   ReadList[fullpath,Number,RecordLists->True (*,
> WordSeparators->{","}*)]; Read::"readn": 
>     "Syntax error reading a real number from \!\(\"FWB 4 GB:Gigabit \
> Ethernet:Of\" \\[Ellipsis] \"urs:2D Image Data:50M_OFL.IMG\"\)."
> All I can guess is that Mathematica expects numbers with decimals, and
> isn't getting the decimals.  If that's true, it's a problem, because
> the instruments don't do decimal numbers.   Is there an "Integer"
> declaration for ReadLists?  "Integer" didn't work.
> Anyway, has anybody managed to get this to work, or have any
> suggestions?

Did you check the technical support FAQ before posting?

P.J. Hinton
Mathematica Programming Group           paulh at Wolfram
Research, Inc.        
Disclaimer: Opinions expressed herein are those of the author alone.

  • Prev by Date: Doing a table of contents ; also : footnotes ?
  • Next by Date: Re: Label Display in 2-D Plots?
  • Previous by thread: Importing CSV (comma separated values) files?
  • Next by thread: Re: Importing CSV (comma separated values) files?