| Author |
Comment/Response |
Miguel
|
10/26/12 6:49pm
Hi
I would like to use a Do loop to fill an array. Something like:
Do[ abc[[i]] = i^2, {i, 1, 5} ]
Hoping that the result is:
abc = {1, 4, 9, 16, 25}
But I get an error instead:
"Set::noval: Symbol abc in part assignment does not have an immediate value"
Now, I know that:
abc = Table [i^2, {i, 1, 5}]
Will do the job, but I would like eventually to fill two or more arrays in a single loop. Is there a way to do this?
URL: , |
|