I would like to assign values from a list l
to variables g1
, g2
, g3
, ....
The list: l=Table[(i^2-10*i)/2,{i,1,10}]
.I would like to assign g1
to the first element of the list l[[1]]
and so on using a loop.
g1=l[[1]]
;
g2=l[[2]]
;
g3=l[[3]]
;
...
ClearAll["Global`*"]
l = Table[(i^2 - 10*i)/2, {i, 1, 10}]
(*{-(9/2), -8, -(21/2), -12, -(25/2), -12, -(21/2), -8, -(9/
2), 0}*)
Do[Symbol["g" <> ToString[i]] = l[[i]], {i, 1, 10}]
How to do it correctly?