Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I'm trying to append filenames with Mathematica, and cannot do it. The output of my calculation are two lists : X and Y, calculated for a varying parameter G.

So I want to have X0, Y0 for G = 0, X0.5, Y0.5 for G = 0.5, etc. In python, I would just automate this by defining X"$G", Y"$G", and do a loop on G.

Is there an equivalent in Mathematica?

share|improve this question

marked as duplicate by Szabolcs, Oleksandr R., Artes, R. M. Mar 16 '13 at 3:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Take a look at StringJoin and ToString. – Szabolcs Mar 15 '13 at 17:18
Also see this. – Jens Mar 15 '13 at 17:41
The title talks about file names, but the question itself never mentions any I/O operation. I'm confused. – m_goldberg Mar 15 '13 at 18:25

Not sure exactly what you are looking for, but you can deal with strings quite nicely in Mathematica. For instance, say you have x="this" and y="that" and you want to write ten files that are numbered consectutively. You might create

 fileNames=Table[StringJoin[x, y, ToString[i]], {i, 1, 10}]

which gives you a list of 10 file names. Of course you can build the names up any way you wish.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.