【发布时间】:2014-02-14 01:22:10
【问题描述】:
我使用 Gnuplot,我想将数据文件的值保存到带有条件的变量中。 例如,我有以下数据文件'example.dat':
columnl column2
5 7.0
3 4.0
7 6.0
在我的 gnuplot 脚本中,我希望能够编写:
variable = " in the file 'example.dat' ($1)==5 ? $2 : 1/0 "
在此处与以下内容相同:
variable = 7.0
当然值取决于数据文件。
那么有可能吗?
如果不是,是否可以无条件?
【问题讨论】:
-
这里的一个答案可能有帮助:stackoverflow.com/questions/7540614/…
-
您可以使用
stats 'example.dat' using ($1 == 5 ? $2 : 0); variable = STATS_sum,但这要求您要提取的值是唯一定义的,即只有一行与条件匹配。
标签: file variables save gnuplot