So far this code Prints just a sequence of numbers, as you can see in the "Print"-Line.
I would like to export the results in one excel sheet, which has rows "b,l,m,d,p,best n, value" and in each column i have one result line. How can I do that?
I think I have to first write a list instead of Print, which I append to each other to create a table. Then I export that table. Unfortuantely I am not able to create the lists, tables and export them even after reading the documentation.
B[n_, b_, l_, m_, d_, p_] := l+m-d-p+n
For[b = 1, b < 3, b++;
For[l = 5, l < 7, l++;
For[m = 3, m < 5, m++;
For[d = 3, d < 5, d++;
For[p = 2, p < 3, p++;
If[NMaxValue[{B[n, b, l, m, d, p], n >= 1},
n \[Element] Integers] <= 0, Print[b, l, m, d, p, 0, 0] , (**)
Print[b, l, m, d, p,
NArgMax[{B[n, b, l, m, d, p], n >= 1}, n \[Element] Integers],
NMaxValue[{B[n, b, l, m, d, p], n \[Element] Integers, n >= 1},
n]]]]]]]]
Print
does? $\endgroup$