如何知道正在传递哪种数据类型
我的框图中有一个Select
函数。对于 True 和 False 语句,我传递两种数据类型。 True 语句是前面板数字指示器的Digital Reference
数据类型,False 语句是前面仪表板的knob Reference
数据类型面板也是如此。我不确定在 Select
函数的中间入口点放置什么,因为它需要有一个 True Boolean。理想情况下,我只需连接另一个“数字参考”数据类型,在这种情况下它将返回数字指示器,但“选择”函数仅接收布尔值作为输入。
I have a Select
function in my block diagram. For the True and False statements I am passing two data types. The True statement is a is a Digital Reference
data type to a numerical indicator in the front panel, and the False statement is a knob Reference
data type to a gauge in the front panel as well. I am not sure what to put in the middle entry point for the Select
function since it needs to have a True Boolean. Ideally I would just connect another Digital Reference
data type and it would return the digital indicator in that case but the Select
function only receives a boolean as an input.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
什么情况下?您还没有定义任何情况。 :-)
Select 节点在两个不同的值之间进行选择。当您将数字参考连接到一个输入并将旋钮参考连接到另一个输入时,输出将是这两个控件之一的控制参考。您必须连接 Bool 才能选择要在下游操作的控件。
您说您想将另一个数字参考连接到中间端子,但这只是对控件的参考。它没有定义选择。也许您想读取其他控件的 Value 属性并对该值执行某些操作?如果是这样,这就是您的代码,您可以在其中进行任何您想要的测试,而不是“等于零”节点。
In what case? You haven't defined any case. :-)
The Select node picks between two different values. When you wire the digital reference to one input and the knob reference to the other input, the output will be a control reference to one of those two controls. You have to wire a Bool in order to pick which control you're going to operate on downstream.
You say you want to wire another Digital Reference to the middle terminal, but that's just a reference to a control. It doesn't define a choice. Perhaps you want to read the Value property of that other control and do something on the value? If so, this is your code, where you put whatever test you want instead of the Equal Zero node.
选择函数需要选择器输入中的布尔值。其他两个输入根据您连接的内容而变化。
因此,在您的场景中:
输出类型是旋钮参考和数字参考之间最底层的常见类别。它应该是一个数字引用。
选择器输入必须是布尔类型。您无法连接任何引用或任何其他数据类型。因此,连接布尔控件或使用 srm 建议的方法。
Select function requires a boolean in the selector input. The other two inputs changes according to what you connect.
So, in your scenario:
Output type is the most lower common class between knob reference and numeric reference. It should be a Numeric reference.
the selector input must be a boolean type. You cannot connect any reference or any other data type. So, connect a boolean control or use the approach suggested by srm.
我通过将
equal
函数连接到select
函数的中间布尔选择器输入找到了解决方案。equal
函数有两个输入,第一个输入为Knob Reference
或Digital Reference
,以及一个Digital Reference
对于第二个输入。如果这两者相等,则equal
函数将 true 传递给selector
函数,然后在这种情况下传递Digital Reference
。I found a solution by connecting an
equal
function to the middle boolean selector input of theselect
function. Theequal
function has two inputs, an eitherKnob Reference
orDigital Reference
for the first input and aDigital Reference
for the second input. If those two are equal then theequal
function passes true to theselector
function and then theDigital Reference
gets passed in this case.