keyboard - 如何修复此 gnuplot 错误以处理按键?
问题描述
我正在尝试为我的 gnuplot 脚本提供基本的键盘交互。我相信我使用gnuplot 5.4 patchlevel 1
的是 MOUSE_CHAR 作为记录,但是使用下面最简单的脚本,无论我按什么键,我都会收到错误消息。
while (1) {
pause mouse keypress
show variable MOUSE_
if (exists("MOUSE_CHAR")) {
if (MOUSE_CHAR == "w") {
print "w"
}
} # <-- line 114
replot
}
输出显示按下了正确的键,例如:
MOUSE_KEY = 119
MOUSE_CHAR = "w"
或者
MOUSE_KEY = 114
MOUSE_CHAR = "r"
但是在我得到之后
"hrtp.gp" line 114: Non-numeric string found where a numeric expression was expected
解决方案
字符串相等的测试eq
不是==
,所以你想要if (MOUSE_CHAR eq "w") { print "w" }
。
推荐阅读
- node.js - child_changed 在 firebase 中没有参考
- java - 弹簧靴中的白标错误!可能是 URL 无法到达控制器
- javascript - 从数组中获取缺失的元素。如果元素不丢失,则返回 null
- html - 如何将文本放在容器中带有 img 标签的图像上,然后在该 div 中居中放置文本?
- python - 从 pypfopt 模块运行 EfficientFrontier 时出现错误消息
- jupyter-notebook - 如何打印目录和段落编号
- android - 删除列表项后从适配器类更新片段 textView 文本
- android - How do I get the parent value from child in Firebase real time database?
- r - 如何添加与 geom_line() 相同的轴 Y 和次轴 X 的水平 geom_col()?
- c# - ISomeInterface 和有什么区别
和 ISomeInterface 在c#中