Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
窗口关闭时Gnuplot退出_Gnuplot - Fatal编程技术网

窗口关闭时Gnuplot退出

窗口关闭时Gnuplot退出,gnuplot,Gnuplot,我使用以下脚本打印.csv文件中的读数。 当模拟运行时,绘图将每秒刷新一次,以显示新数据。这是一个不错的工作方式,虽然有点难看,因为整个数据集都被重新读取了(如果你有更好的解决方案,请让我知道) 但是,当我关闭gnuplot窗口时,脚本不会退出,但是在暂停1秒后,会生成一个新窗口,这有点烦人。我宁愿在关闭窗口后关闭脚本。有办法把这个归档吗 #!/usr/bin/gnuplot set t wxt enhanced noraise set datafile separator ";" plot "

我使用以下脚本打印.csv文件中的读数。 当模拟运行时,绘图将每秒刷新一次,以显示新数据。这是一个不错的工作方式,虽然有点难看,因为整个数据集都被重新读取了(如果你有更好的解决方案,请让我知道)

但是,当我关闭gnuplot窗口时,脚本不会退出,但是在暂停1秒后,会生成一个新窗口,这有点烦人。我宁愿在关闭窗口后关闭脚本。有办法把这个归档吗

#!/usr/bin/gnuplot
set t wxt enhanced noraise
set datafile separator ";"
plot "../build/inputLink.csv" using 1:5 title 'Input Gear' with lines ,\
     "../build/inputLink.csv" using 1:7 title 'Input Gear Ratio' with lines,\
     ;
pause 1
reread

gnuplot中没有这样的功能,可以绑定窗口的
close
按钮退出程序。但是,您可以使用
bind
定义退出循环的热键:

#!/usr/bin/gnuplot
set t wxt enhanced noraise
set datafile separator ";"
set style data lines

done = 0
bind all 'd' 'done = 1'
while(!done) {
  plot "../build/inputLink.csv" using 1:5 title 'Input Gear',\
       "" using 1:7 title 'Input Gear Ratio'
  pause 1
}

不,除了每次重新读取整个数据集之外,没有其他方法可以刷新绘图。

读取/重新读取写入文件的最后100行,该文件将附加任何新数据

plot "< tail -n 100 ../build/inputLink.csv" using 1:5 title \
'Input Gear' with lines , \
, "< tail -n 100"../build/inputLink.csv" using 1:7 title \
'Input Gear Ratio' with lines,\
     ;
pause 1
bind "s" "unset output ; exit gnuplot"
reread