在gnuplot 4.0版本中执行'for'循环支持吗?

时间:2015-04-29 17:38:08

标签: gnuplot

我在使用for循环

时收到错误:Invalid expression

这是数据文件:

TEST.DAT

# C1 C2 C3
23 b 323
23 g 54
23 a 11
23 c 1
23 d 0
23 e 397
23 f 40
24 b 23
24 g 24
24 a 113
24 c 12
24 d 10
24 e 7
24 f 50

在Unix中,使用gnuplot 4.0:

gnuplot> plot for [s in 'a b c d e f g'] sprintf("<(grep '%s' test.dat)", s) using 1:3 with lines

                   ^
         invalid expression

我的办公室服务器上安装了4.0版本,我们应该继续使用它。

当我在使用gnuplot 5.0的本地Windows机器上尝试相同的命令时,我收到了一个不同的错误:

gnuplot> plot \
       > for [s in 'a b c d e f g'] \
       > sprintf("<(grep '%s' testdata1.dat)", s) \
       > using 1:3 with lines            
         warning: Skipping unreadable file "<(grep 'a' testdata1.dat)"
         warning: Skipping unreadable file "<(grep 'b' testdata1.dat)"
         warning: Skipping unreadable file "<(grep 'c' testdata1.dat)"
         warning: Skipping unreadable file "<(grep 'd' testdata1.dat)"
         warning: Skipping unreadable file "<(grep 'e' testdata1.dat)"
         warning: Skipping unreadable file "<(grep 'f' testdata1.dat)"
         warning: Skipping unreadable file "<(grep 'g' testdata1.dat)"
         No data in plot

这里的for循环有效,但是将文件内容重定向到sprintf不起作用。

预期结果是,对于s的每个值, test.dat 的grepped内容重定向到 sprintf ,用作绘图的数据源导致多个重叠图。

在此示例中,

对于s=='a',输出应为

#C1 C2 C3
23 a 11
24 a 113

但是,似乎管道在窗户中不起作用。不幸的是,我无法在Unix或Windows中测试脚本是否有效。

请建议。

0 个答案:

没有答案