I have a list like this:
list = {"k1","k2"} I want to use the elements in the list as Table indicators:
Table[k1 + k2, {ToExpression@list[[1]], 1, 2}, {ToExpression@list[[2]], 1, 2}] but I get an error:
Table::write: Tag ToExpression in ToExpression[list[[1]]] is Protected.
Is there a way to get the right answer like:
Table[k1 + k2, {k1, 1, 2}, {k2, 1, 2}] {{2, 3}, {3, 4}}
With[{kk1 = ToExpression@list[[1]], kk2 =ToExpression@list[[2]]}, Table[k1 + k2, {kk1, 1, 2}, {kk2, 1, 2}]]. See the Possible Issues section ofTable:) $\endgroup$