MathGroup Archive 2004

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

Search the Archive

Re: conerting integer to string

  • To: mathgroup at
  • Subject: [mg46489] Re: conerting integer to string
  • From: Bill Rowe <readnewsciv at>
  • Date: Fri, 20 Feb 2004 00:29:42 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 2/19/04 at 3:02 AM, dsenglish at (Doug English) wrote:

>Hi, I would like to export data to a series of files and number the
>files sequentially.  I am creating the file contents in a Do loop
>and want to use the increment variable, in this case i, as part of
>the file name.  The problem is I can't figure out how to convert i
>to a string. Can someone please help me with this?  

The answer to your specific question is to use ToString. That is


will return {"file1","file2","file3","file4","file5"}

But to export data in the manner you indicate, I would not use a Do loop. Instead, I would use

MapIndexed[Export["file"<>ToString@First@#2, #1, "CSV"]&, dataList]

where dataList was a list of all the data I wanted to export.

This would export the items in dataList to files named file1, file2 etc, where the 1, 2, etc would be the position of the data being exported in dataList.
To reply via email subtract one hundred and four

  • Prev by Date: Re: Help!!!!
  • Next by Date: Re: permutations?
  • Previous by thread: Re: conerting integer to string
  • Next by thread: permutations?