MathGroup Archive 2008

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

Search the Archive

Re: Trouble related to "CSV"

  • To: mathgroup at
  • Subject: [mg90468] Re: Trouble related to "CSV"
  • From: email.slim at
  • Date: Thu, 10 Jul 2008 06:35:37 -0400 (EDT)
  • References: <g51uj4$730$>

On Jul 9, 1:58 am, Bill Rowe <readn... at> wrote:
> On 7/8/08 at 2:26 AM, email.s... at wrote:
> >I'm trying to read in data from a text file composed of strings and
> >tables of comma separated integers. Here's what I have:
> >rows = cols = 45; readstr = OpenRead["teststr.txt"];
> >For[r = 1, r =98 rows,
> >{For[c = 1, c =98 cols, { p[[r, c]] = Read[readstr, "CSV"], l =
> >Partition[p[r, c], rows], c++}], r++}],
> >=2E......
> >I am able to get this working on one machine with Mathematica 5.2,
> >but I can't get it to work on another machine with Mathematica 5.0
> >or Mathematica 6.0.  Does anyone know how to fix this problem?
> Why are you wasting your time to write a custom routine to read
> in such simple data from a file using commas to separate the
> values when
> Import["teststr.txt","CSV"]
> will do it for you? This will work in Mathematica version 4 and newer.
> Yes, it is possible to write a custom routine that will read
> files faster than Import will. But code using For in Mathematica
> is definitely not a way to improve on Import

Hi Bill,

Thanks for your reply.

The problem is the text file is composed of mix of strings and
integers, some are separated by space, and the rest by commas.
But I'll definitely try
=02> Import["teststr.txt","CSV"]
and see how it turns out.

  • Prev by Date: Re: PlotRange Trouble
  • Next by Date: Re: Question about diference between Animate and Manipulate
  • Previous by thread: Re: Trouble related to "CSV"
  • Next by thread: Re: Trouble related to "CSV"