I'm trying to create several symbols and assign values to them. Here's what currently appears to work:
Evaluate[Symbol["fdds" <> ToString[10]]] = 1
But there's then another problem: I can't clear it without explicitly saying fdds10, i.e. this code
Evaluate[Symbol["fdds" <> ToString[10]]] =.
as well as this
Clear[Evaluate[Symbol["fdds" <> ToString[10]]]]
give errors: the former gives
Unset::usraw: Cannot unset raw object 1. >>
and the latter results in
Clear::ssym: 1 is not a symbol or a string. >>
How do I create good easily manageable symbols?
PS: I know I could use something like fdds[[10]] here, but I'm interested in symbol-based solution.
SymbolandToExpressionhere if the latter is used just with one argument? Could I just replace the former with the latter for the first assignment? – Ruslan Jun 28 '14 at 19:35ToExpressionis just a more high-level function that can act on expressions (even lists of expressions). The strings accepted bySymbolare limited to be valid symbol names. Because of this relationship, you can definitely useToExpressionin place ofSymbolwhen you're sure you've constructed a valid symbol name string. – Jens Jun 28 '14 at 19:43