如果控制序列在Gnuplot下 [英] If control sequence under Gnuplot

查看:113
本文介绍了如果控制序列在Gnuplot下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Gnuplot下执行控制序列?
我需要做类似的事情

How to perform control sequences under Gnuplot please? I need to make something like

if (x == nan)
  set xrange[]

else
  set xrange[10:30]

我试过类似

( x > 100000 ) ?  (set xrange[]) : (set xrange[10:30])

...但是没有成功!我花了几个小时试图解决这个问题!
请帮忙吗?
最糟糕的是我可以创建一个shell脚本来管理它,但我认为应该有一些控制序列来解决这个问题。

... buth without success! I spent hours trying to solve this!! Any help please? At worst I can create a shell script an manage this, but I think there should be some control sequences to fix this.

推荐答案

对于gnuplot 4.4.4 if 语句必须在一行上:

For gnuplot 4.4.4 the if statement must be on a single line:

if (x > 10000) set autoscale x; else set xrange [10:30]

或使用 \ 继续下一行。

if (x > 10000) \
    set autoscale x; \
else \
    set xrange [10:30]

自4.6.0 gnuplot可以使用括号来分隔分支:

Since 4.6.0 gnuplot can use brackets to delimit the branches:

if (x > 10000) {
    set autoscale x
} else {
    set xrange [10:30]
}

这篇关于如果控制序列在Gnuplot下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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