gpt4 book ai didi

关闭窗口时退出 Gnuplot

转载 作者:行者123 更新时间:2023-12-04 18:39:48 36 4
gpt4 key购买 nike

我使用以下脚本从 .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 中并没有这样的功能来绑定(bind)窗口的 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
}

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

关于关闭窗口时退出 Gnuplot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29063622/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com