I'm trying to do the following with an expression:
filename=StringJoin[{"myfile", ToString[someNumber],".m"}];
expression >> filename;
But mathematica keeps creating a file named "filename", instead of "myfile42.m"
Any idea how can I tell Put
to pretty please, use the filename string value, instead of the expression's name?
Put
rather than>>
andGet
rather than<<
. $\endgroup$Put
andGet
form and the problem persisted. The correct solution was the one suggested by @Nasser using Evaluate $\endgroup$Attributes[{Get, Put}]
? On my machine it is{{Protected}, {Protected}}
. That means these do not have Hold attributes and thereforefilename
will be evaluated. What exactly did you try? $\endgroup$