rename variable in a loop
Posted: Thu Dec 11, 2014 7:34 pm
Hello,
I have a loop that returns a number of array's
[0.998,0.001,0.0005,0.0005,0]
[0,0.995,0.003,0.001,0.001]
[0,0,0.995,0.0025,0.0025]
[0,0,0,0,1]
I need to construct a number of variables each representing one of the arrays
var S1 = [0.998,0.001,0.0005,0.0005,0]
var S2 = [0,0.995,0.003,0.001,0.001]
var S3 = [0,0,0.995,0.0025,0.0025]
var S4 = [0,0,0,0,1]
is there a way to name the variables like:
var S[r] = P[r]?
I would appreciate any help.
Irene
I have a loop that returns a number of array's
- Code: Select all
for(var r = 1; r<=rMax-1; r++)
{
var P =datasetarray.getRowAsArray(r);
}
[0.998,0.001,0.0005,0.0005,0]
[0,0.995,0.003,0.001,0.001]
[0,0,0.995,0.0025,0.0025]
[0,0,0,0,1]
I need to construct a number of variables each representing one of the arrays
var S1 = [0.998,0.001,0.0005,0.0005,0]
var S2 = [0,0.995,0.003,0.001,0.001]
var S3 = [0,0,0.995,0.0025,0.0025]
var S4 = [0,0,0,0,1]
is there a way to name the variables like:
var S[r] = P[r]?
I would appreciate any help.
Irene