Is it possible to clear output in Livebook?

Hi all,

I am building a traffic simulator and I have been using Livebook to iterate through steps in the simulation. Is there a command I can run that clears the output of IO.inspect calls. I have tried IEx.Helpers.clear and straight up printing the clear ANSI codes IO.puts("\e[H\e[2J") but no luck.

These would work in IEx but not Livebook it seems.

Any suggestions?

Turns out it is as simple as using IO.write to output and \r to reset the “writer” to the start of the line. Eg

for step <- 0..100 do
  IO.write("\r #{step}/#{epoch}")
end
1 Like

I found this question while looking for something similar. I was hoping there would be a way to interactively clear the output of a particular cell. There already is one to “amplify output”, would be great if there is a way to “clear” it as well. (see image, below).
clear-output

1 Like