如何将 Mathematica 打印和错误打印重定向到文件?
如何将 Mathematica 打印和错误打印重定向到文件?
有时,Mathematica 程序
- 1) 使用
Print[]
打印消息, - 2) 有时,某些函数在没有任何显式
Print[]
的情况下会产生副作用类型的打印 - 3)有时会出现打印错误。
如何将上述三种打印重定向到(单独的)文本文件,以便在 Mathematica 内核关闭时可以(单独)存档它们?
How to redirect Mathematica printing and error printing to files?
Sometimes, a Mathematica program
- 1) uses
Print[]
to print messages, - 2) sometimes, there is side-effect type of printing by some functions without any explicit
Print[]
- 3) and sometimes there is error printing.
How to redirect the above three varieties of printing to (separate) text files, so they can be archived (separately) when the Mathematica kernel is closed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Print[]
默认情况下输出到流$Output
。消息进入$Messages
流。您可以重新定义这两个全局变量以将输出重定向到文件:Print[]
by default outputs to the stream$Output
. Messages go to the$Messages
stream. You can redefine these two global variables to redirect the output to a file: