【问题标题】:Read data in Gnuplot在 Gnuplot 中读取数据
【发布时间】:2016-07-26 13:17:00
【问题描述】:

我有一个带有如下矩阵的文件:

1 2 3
4 5 6
7 8 9

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

【问题讨论】:

标签: gnuplot


【解决方案1】:

您可以在 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 命令可以同时做一些有用的事情,比如……绘制一些东西。

【讨论】:

    【解决方案2】:

    谢谢,实际上使用这个语法已经解决了:

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

    这里已经解释得很清楚了: by @StackJack

    【讨论】:

    • 我会使用stats。 StackJack 是从那个功能还没有实现的时候开始的。
    猜你喜欢
    • 2023-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-03
    相关资源
    最近更新 更多