Message Boards Message Boards

GROUPS:

Create a table with results coming from "While" command

Posted 2 months ago
318 Views
|
2 Replies
|
2 Total Likes
|

Hello,

I would like to store the results computed in a "while" loop in on unique Table with one unique TableHeadings. For now, I'm able to print the result at each stage and hence the Table Headings is reeted each time. I'm sure that there is a more suitable solution. Thank you!

My code:

While [R[t] >= 650 && t <= 300,
 .........
.......... 
 dataset = 
  TableForm[
   ptsF = Table[{t, R[t], W[t], G0[t], GC0[t], GLT[t], GP[t]}, {t, t, 
      t}], TableHeadings -> {None, {"t", "Ressources", "Extraction", 
      "Gain instantané", "Gain instantané cumulé", "Gain infini LT", 
      "Gain partie"}}]; Print[dataset];
 t++]
2 Replies
Posted 2 months ago

Maybe you could use Sow[] to collect the un-formatted results inside the While and then use Reap[] to get the collected values.

Posted 2 months ago

Hi Marion,

You could also use the TableWhile function from the Wolfram Function Repository.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract