How can I assign a value for a symbol composed of a string plus and another string converted from integer?
n=3;
Symbol["as"<>ToString[n]]=4;
So I want to assign a value 4 to the new symbol as3. But it does not work.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityIs this what you want?
n = 3;
Set[#, 4]& @ Symbol["as" <> ToString[n]]
Evaluate@Symbol["as" <> ToString[n]] = 4
. It will only work once. $\endgroup$