如何使用gnuplot的print语句写入stdout? [英] How to write to stdout with gnuplot's print statement?

查看:115
本文介绍了如何使用gnuplot的print语句写入stdout?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在脚本中使用以下命令时,gnuplot会将test打印到stderr:

When I use the following in my script, gnuplot will print test to stderr:

print "test"

但是,我只想将test写入stdout,因为只有错误应该写入stderr.

However, I want to write test to stdout as only errors should be written to stderr.

推荐答案

如gnuplot文档中所述(在交互式gnuplot控制台中键入help print):

As stated in the gnuplot docs (type help print in interactive gnuplot console):

可以通过设置打印来设置输出文件.

The output file can be set with set print.

所以,让我们看一下set print:

没有"<filename>",输出文件将还原到<STDERR>.这 <filename> "-"表示<STDOUT>.

Without "<filename>", the output file is restored to <STDERR>. The <filename> "-" means <STDOUT>.

因此,只需在gnuplot脚本的顶部添加一个set print "-",然后将print语句打印的所有内容写入stdout.

So simply add a set print "-" at the top of your gnuplot script and everything printed by the print-statement is written to stdout.

这篇关于如何使用gnuplot的print语句写入stdout?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆