I am trying to get a nested table but my code gives the output matrix with the right dimensions but the data in the wrong place. My code is:
seq1 = {52.000, 52.289, 39.000,
0.000, -10.121, -19.000, -22.000, -28.203, -18.000, -6.000, -5.615,
0.000, 0.000, 1.770, 2.000, 4.000, 3.903,
2.000, -4.000, -3.729, -3.000, 4.000, 20.378, 20.000, 47.000,
74.958, 58.000, 54.000, 68.563, 40.000, 50};
seq2 = {52.000, 52.289, 39.000, -12.000, -1.792, -6.000, 49.000,
69.931, 59.000, 24.000, 27.989, 7.000, 7.000, 21.857, 18.000,
41.000, 55.666, 41.000, 18.000, 33.127, 18.000, 41.000, 57.813,
43.000, 25.000, 28.099, 11.000, 2.000, -2.715, -6.000};
window = 10;
offsetwindow = 5;
coltot = IntegerPart[Length[seq1]/window]
rowtot = Length[Partition[seq2, window, offsetwindow]]
dist1 = Tuples[{Partition[seq1, window, window],
Partition[seq2, window, offsetwindow]}]
outtable =
Table [CanonicalWarpingDistance[dist1[[i, 1]], dist1[[i, 2]],
Automatic, {"SlantedBand", 950},
Method -> {"MatchingInterval" -> "Flexible"},
DistanceFunction -> CosineDistance], {i, 1, rowtot}, {j, 1,
coltot}]
The output is:
{{2936.43, 2936.43, 2936.43}, {2010.95, 2010.95, 2010.95}, {805.145,
805.145, 805.145}, {1277.23, 1277.23, 1277.23}, {646.763, 646.763,
646.763}}
But it should be:
{{2936.43,2010.95,805.145},{1277.23,646.763,40.0572}, {11.9107, 28.5548, 52.7854}, {14.1702, 1305.69, 1775.71},{412.422, 773.669, 726.661}}
I verified the values by running the code with output as an unnested list and the total list of output values are:
{2936.43, 2010.95, 805.145, 1277.23, 646.763, 40.0572, 11.9107, \
28.5548, 52.7854, 14.1702, 1305.69, 1775.71, 412.422, 773.669, \
726.661}
I just need them in matrix form. In this particular case it should be a 3X5 matrix but that will change depending on the input variables seq1 and seq2. The size of the matrix will be "rowtot" X "coltot." Where am I going wrong?