Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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, rm -rf 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

1 Answer 1

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.