Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • $\begingroup$ Try with Symbol["name"]: "refers to a symbol with the specified name." $\endgroup$ Commented Aug 1, 2014 at 18:57
  • 3
    $\begingroup$ Maybe there are shorter idioms for this, but one way is: Evaluate[ToExpression["d"~~ToString[i]]] = 30 $\endgroup$ Commented Aug 1, 2014 at 19:08
  • 1
    $\begingroup$ I'm wondering if you want x[i]? It's not exactly what you asked for; but if you don't know you can use x[i] as a variable, which represents x[10] when i is 10, then you might not know to ask for it. $\endgroup$ Commented Aug 1, 2014 at 19:13
  • $\begingroup$ Daniel, your suggestion works very well. Thanks a lot. $\endgroup$ Commented Aug 1, 2014 at 19:26
  • 1
    $\begingroup$ @Luis Be aware that Daniel's simple suggestion will not allow reassignment. (As I'm sure he knows.) I again updated my answer to make clear that the method I gave does allow reassignments. $\endgroup$ Commented Aug 1, 2014 at 19:40