In this example I used appendTo.
f[x_] := x + 1;data = {};For[x = 1, x <= 10, x++,f[x];spec = AppendTo[data, {x, f[x]}]] // Timing // First
f[x_] := x + 1;
data = {};
For[x = 1, x <= 10, x++,
f[x];
spec = AppendTo[data, {x, f[x]}]] // Timing // First
Out[37]= 0.000054
ListPlot[spec]
Let’s block ads! (Why?)
Recent Questions – Mathematica Stack Exchange