Re: Trouble related to "CSV"

*To*: mathgroup at smc.vnet.net*Subject*: [mg90443] Re: Trouble related to "CSV"*From*: Bill Rowe <readnews at sbcglobal.net>*Date*: Wed, 9 Jul 2008 04:56:11 -0400 (EDT)

On 7/8/08 at 2:26 AM, email.slim at gmail.com 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