I am trying to generate different variables in function of a loop index. In example: generating a list with var1 = 1, var2 = 2, ...
For[i=0,i<5,i++, ToExpression[ "var"<>ToString[i] <> " = " <> ToString[i]] ]
I learnd how to use the 'ToExpression' function and it worked for the example avobe. But when I want to, for example import data, I have to add double quotes
"" inside the
ToExpression function, then I get wrong results, for example.
For importing files in different variables:
For[i = 0, i < 8, i++, ToExpression[ "band0" <> ToString[i] <> " = Import["/home/data/band0 "<> ToString[i] <>".txt "]" ] ]
It looks like confuses Mathematica because each block around quotes is considered by separate.
Then, what could I do?