我要使用case语句实现一个功能,输入一个数值,为1时,a1,b1,c1亮,为2时,A2,B2,C2亮,。。。。为20时,A20,B20,C20D亮,An,Bn,Cn 是布尔量,怎么实现,关键是选1是A-C1亮了,怎么实现,选2或其他的时候,A-C1熄灭。
已解决! 转到解答。
Hi
Attached an example that uses Ring (as Case selector) and Array of (Boolean) Cluster to accomplish the task.
When Ring value changed, Case (True) is executed; Element (Boolean Cluster) of the Index of "previous Ring value" is set to False, and the new Ring value sets the corresponding Element (Boolean Cluster) to True. So on and so forth...
PS1: This is merely an example for reference purpose. You may need to alter to meet your needs.
PS2: Cluster of Boolean Cluster may be used instead of Array of Boolean Cluster.
看看能否直接使用数据流方式。
thanks.
谢谢,不过还有一个问题,我开始没讲清楚,就是:在选定每个数值时,要控制的布尔量数目是不一样的,比如,输入1时,控制A1B1C1;输入2时,要控制A2B2C2D2,输入3时,可能只控制A3。不好意思,我开始没注意到这个问题
还有一点就是:我要控制的不是布尔灯,而是其它一些可以用布尔的01控制的量,它们散布在前面板的各处,不知道能不能实现建成一个簇,我对簇了解不多
我自己想了一个办法,不用簇,直接用你生成的数组控制那些布尔量的局部变量值,但这样看起来太繁琐了,有没有什么好的办法
首先要考虑前面板设计是否合理,这些开关量是否都需要,其中是否有相同功能的,是否可以合理分组,每个分组采用数组或者簇。LABVIEW的控件分为输入控件和显示控件,考虑能否合理布局,分为控制区域和显示区域,这样更容易控制。如果几十个布尔控件没有任何关系,凌乱分布各处,很难集中处理。
谢谢了