2

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?

JuanC97
  • 612
  • 3
  • 10

2 Answers2

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}]

enter image description here

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}]

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896