读取Gnuplot中的数据

时间:2016-07-26 13:17:01

标签: gnuplot

我有一个矩阵文件,如:

1 2 3
4 5 6
7 8 9

使用gnuplot,我想在第2列的第3行中提取变量,并将其存储在名为X的变量中。请使用gnuplot如何做到这一点。 谢谢

2 个答案:

答案 0 :(得分:0)

您可以在plot命令

中执行此操作
set table "/dev/null"
X=0
X_row=3
X_col=2
plot "file.dat" using (($0==X_row)?(X=column(X_col),X):0)
unset table

为了节省时间,plot命令可以同时执行一些有用的操作,例如...绘制内容。

答案 1 :(得分:0)

谢谢,实际上使用这种语法解决了这个问题:

plot u 0:($0==RowIndex?(VariableName=$ColumnIndex):$ColumnIndex)
#RowIndex starts with 0, ColumnIndex starts with 1
print VariableName

这里已经解释得很好: by @StackJack