I want to import a data file named "A(var1)B(var2)C(var3).dat" where the values of the variables var1, var2, var3 are being provided by a function. How can I do that?

  • $\begingroup$ Take a look at StringJoin, ToString or at StringTemplate. $\endgroup$
    – Kuba
    Dec 1, 2018 at 12:42

1 Answer 1

a = 2;
b = 4;
c = 5;
StringJoin[ToString[a], ToString[b], ToString[c], ".dat"]    


or you can add more strings

StringJoin["A",ToString[a],"_B",ToString[b],"_C",ToString[c], ".dat"]   



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