This question already has an answer here:

I have a module in which at the end a table is exported. That works well. Now I want to use that module such that I can transfer a part of a file name as an argument, such as

sig[costmin_, costmax_, name_] :=
now table sigma1 is calculated, then exported
Export["file.name.txt", sigma1, "Table"]

The filename of the export file should have the name file.name.txt where 'name' is one of the input arguments to the module so that different results for different input parameters costmin and costmax can be written to different files. How do I do this. As written above it does not work.


marked as duplicate by Kuba Nov 30 '17 at 12:41

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.

  • $\begingroup$ I have found an easier solution: 'Export[ StringJoin[{"neutrino.EprimeCostplaneXS.", ToString[name], ".txt"}], sigma1, "Table" ]' $\endgroup$ – user3584513 Dec 1 '17 at 9:04
  • $\begingroup$ StringJoin + ToString is exactly the solution in linked topic. What do you mean by 'easier'? $\endgroup$ – Kuba Dec 1 '17 at 9:08
  • $\begingroup$ StringJoin makes it easier $\endgroup$ – user3584513 Dec 1 '17 at 9:09
  • $\begingroup$ StringJoin makes it easier than StringJoin? $\endgroup$ – Kuba Dec 1 '17 at 9:11