I want to do a for loop to compute some values, create a new (sub-)section and print those values there within each iteration. How would it be possible?
Asked
Active
Viewed 89 times
2 Answers
4
You gave very little details as to exactly what you're after, but something like the following should be a good start:
Do[CellPrint[Cell[ToString@RandomReal[], "Subsection"]], {i, 1, 10}]
ktm
- 4,242
- 20
- 28
3
Do[CellPrint[
CellGroup[{TextCell["i = " <> ToString@i, "Subsection"],
ExpressionCell[Plot[Sin[i x], {x, -Pi, Pi}, ImageSize -> 150], "Output"]}]],
{i, 1, 3}]
kglr
- 394,356
- 18
- 477
- 896


CellPrintis probably the core function you'd use in this case. You can find other helpful functions here. – ktm Sep 09 '18 at 01:39