在我的OS系统上,我使用默认的'qt‘终端开发了一系列gnuplot脚本。这样可以方便地在脚本完成时关闭qt窗口,因此我添加了以下内容:
pause mouse "mouse button 2 or 3 to close\n";在稍后的开发中,我希望输出到pdf,但现在暂停挂起我的命令行终端,直到我点击返回。我想做:
set terminal pdf
...
if (terminal eq qt) pause mouse "mouse button 2 or 3 to close\n";但这给了我:
第45行:未定义变量:终端
现在,我有了一个解决办法,可以设置一个不同的变量,并从它设置终端:
term = 'qt'
if (term eq 'pdf') set terminal pdf ; set output 'rToR.pdf'
...
if (term eq 'qt') pause mouse "mouse button 2 or 3 to close\n";对于某些代码设计方面来说,这可能更好,但需要一层冗余,这实际上不是我想要做的。
因此,是否有办法/如何访问像‘终端’这样的gnuplot设置的值?
发布于 2013-11-06 10:40:45
有关可用变量的列表,请参见show variables all。在您的情况下,您需要GPVAL_TERM
if (GPVAL_TERM eq 'qt') { ... }
if (GPVAL_TERM eq 'pdfcairo') { ... }对于set terminal pdf,通常会选择pdfcairo终端,因此需要字符串'pdfcairo'进行比较。
https://stackoverflow.com/questions/19809547
复制相似问题