julia - 使用 Julia 将 in() 与元组数组一起使用时出错
问题描述
我有 2 个元组数组,我有一个循环询问一个元素是否在另一个元素中。在每一步我都会询问坐标数组中包含的元组是否在 Y 数组中。该循环工作正常,除了一个我无法解释原因的元素。这是我所拥有的:
Y[55:65] # This is the array I want to check at each step if my state is in or not.
11 元素数组{Any,1}: (2.0, 1.0) (3.0, 1.0) (4.0, 1.0) (5.0, 1.0) (6.0, 1.0) (7.0, 1.0) (8.0, 1.0) (9.0, 1.0) (10.0, 1.0) (11.0, 1.0) (12.0, 1.0)
coord[i-1] # this is one element of coord that is in Y
0维数组{Tuple{Float64,Float64},0}: (6.0, 1.0)
coord[i] # this is an other element of coord that is in Y
0维数组{Tuple{Float64,Float64},0}: (7.0, 1.0)
但是当我测试它们在 Y 时:
in(coord[i],Y[55:65]) # testing if coord[i] is in Y
错误的
in(coord[i-1],Y[55:65]) # testing if coord[i-1] is in Y
真的
我不明白:它们在 Y 中都以相同的方式表示,它们具有相同的类型,为什么我从使用 in() 得到一个在而不是另一个?
我使用 Julia 版本 0.6.3。
在此先感谢您的帮助!
解决方案
推荐阅读
- c++ - 使用 arduino 和处理使用 2 个 LED 和 2 个按钮
- ruby-on-rails - “config/initializers/new_framework_defaults_5_2.rb”是如何工作的?
- python - TensorBoard 不显示任何内容
- sql - 根据时间戳过滤sql结果
- excel - 基于其他列的条件格式
- dart - 使用“where”在对象列表中搜索 dart 中的特定对象
- python-3.x - 在带有 selenium 的 Javascript 中找不到我需要单击链接的元素
- javascript - Redux - 取消订阅监听器如何工作?
- java - build.gradle 中使用 Gradle 属性
- sms - 将非 VoIP 号码移植到 Twilio 后 - 它是 VoIP 还是非 VoIP 号码?