Gnuplot退出窗口关闭 [英] Gnuplot exit on window close
问题描述
我使用以下脚本从.csv文件中打印读数. 模拟运行时,图每秒刷新一次以显示新数据.这有点不错,尽管由于重新读取整个数据集有些丑陋(如果您有更好的解决方案,请告诉我)
I use the following script to print readings from a .csv file. The plot is refreshed every second to show new data when a simulation is running. This works kinda nice, although is a little ugly since the whole dataset is reread (if you have a better solution please let me know)
但是,当我关闭gnuplot窗口时,脚本不会退出,但是在暂停一秒钟后会生成一个新窗口,这有点烦人.我宁愿在关闭窗口后关闭脚本.有没有办法存档?
However, when I close the gnuplot window the script does not exit, but after 1 second pause a new window spawns, which is kinda annoying. I'd rather have my script closed once i close the window. Is there a way to archieve this?
#!/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
定义退出循环的热键:
There isn't exactly such a functionality in gnuplot, to bind the window's close
button to exit the program. However, you can use bind
to define a hot-key which exits the loop:
#!/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
}
不,除了每次都重新读取整个数据集之外,没有其他方法可以刷新图.
And no, there is no other way to refresh the plot other than rereading the whole data set every time.
这篇关于Gnuplot退出窗口关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!