# Exporting to a single spreadsheet in excel

I would like to export the output to excel file. But when I exported,for each value $q$ I am getting a different sheet. Can someone help me how to export it to a single sheet of an excel file. Thanks

data = Table[
P = 0.75;
A[t] = Sum[(i p[i][t])/F, {i, 1, F - 1}];
k = 1/(q - 1);
node[j_] := p[j]'[t] == P A [t] (- k p[0][t] + 1/F p[j + 1][t]);
system1 = Table[node[j], {j, 0, 0}];
node[i_] :=
p[i]'[t] == (1 - P)/F ((i - 1) p[i - 1][t] - i p[i][t] ) +
P A[t] (-((F - i)/F) k p[i][t] + (F - i + 1)/F k p[i - 1][t] + (
i + 1)/F p[i + 1][t] - i/F p[i][t]);
system2 = Table[node[i], {i, 1, F - 1}];
node[l_] :=
p[l]'[t] == ((1 - P) (F - 1))/F p[F - 1][t] +
P A [t] ((p[F - 1][t] k)/F - p[F][t]);
system3 = Table[node[l], {l, F, F}];
system = Join[system1, system2, system3];
initialcondition =
Table[p[m][0] == Binomial[F, m] k^m (1 - k)^(F - m), {m, 0, F}];
funcs = Table[p[m], {m, 0, F}];
s = NDSolve[{system, initialcondition}, funcs, {t, 0, 2900000}];
p[F][100] /. s, {q, 3, 20}, {F, 3, 10}]

• Export["results.xls", Flatten[data]] Nov 4, 2014 at 20:27

data


You need to remove the braces around the individual data elements to obtain a rectangular table. You can do this in a number of ways:

dt1 = Join @@@ data;
dt2 = Map[Flatten, data, -2];
dt3 = Flatten[data, {3, 1}];
dt4 = data /. {x_?NumericQ} :> x;

dt1 == dt2 == dt3 == dt4
(* True *)

dt1


Export["test.xls", dt1]