Message Boards Message Boards

0
|
8267 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Is there a function that allows to erase the last-printed line in output?

Posted 10 years ago

Hi, guys. Is there any way to erase the last created line of output?

I am trying to make a code that allows to inspect the printed lines and delete the last line or some lines printed in output cells.

But as I look up what functionality is allowed about it, the only function I could find is just deleting all output cells.

What I look for is deleting one line which is last printed in output cells. How can I do that?

Thank you. :)

POSTED BY: Dong Hyeon Ghang
3 Replies

Could you give an example of an input that has multiple printed output lines. Typically an Input cell will only generate a single Output cell unless more than one of the commands in the Input Cell are not terminated by a semicolon.

POSTED BY: David Reiss

If you know the CellLabel of the output cell you are interested in deleting then you can do that with code of the form (say it is the 4th output cell):

NotebookFind[EvaluationNotebook[], "Out[4]=", All, CellLabel];
NotebookDelete[EvaluationNotebook[]]

This assumes that this code is executed in the notebook in question. Based on this example you could create a small interface that does this in a variety of ways depending on your needs.

But, if all you want to do is to suppress the output of a particular cell, then of course, just append a semicolon to the last expression in the cell.

Other things you may want to look into are $Post, CellEvaluationFunction, and CellEpilog and other functions related to them.

POSTED BY: David Reiss

Thank you for your answer, Mr.Reiss.

What you said was very curious and I am now trying to understand that. It is helpful. :)

And additionally, however, What I exactly wanna do is deleting just one line of last printed output, not the whole output cell.

I think, considering its powerful system, wolfram language definitely can do that. Would you look for that matter with me?

Thank you.(I am not a native English speaker so my expression could cause some misunderstanding.)

POSTED BY: Dong Hyeon Ghang
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