NI LabVIEW,CVI,数据采集等产品讨论区

取消
显示结果 
搜索替代 
您的意思是: 

如何实现此功能?

已解决!
转到解答

未命名.jpg

 

如图所示(为省略图,每一行有很多参数,现只展示前面的部分),我想要实现一种功能:我设定第一行的参数,然后选定1,选择开始,程序就按照第一行的参数运行,同样,选择其他行就会按照其他行的参数运行,本来想用Multicolumn Listbox来实现,可是因为我每一行的每一个参数都是有设定其范围的,而且彼此之间存在约束关系,而Multicolumn Listbox好像不能实现设定里面的值吧?而且我的参数都是number形式,它的值应该是string形式的,所以我不知道是不是就不能用了。如果不行,我实在是不想在前面板上列N个numeric control控件,有没有别的控件可以实现我说的功能呢?

简单点说:程序运行前,我在类似图中的列表中输入参数,这个参数是有限定其取值范围和彼此关系的(同列的取值范围一样),输入完毕后,选定某一行,再选定开始键,程序就会按照该行的参数运行。

 

请高手指点迷津!!!

0 项奖励
1 条消息(共 9 条)
6,514 次查看

Yes, you may use Multicolumn Listbox (MCLB) to achieve that.

 

Although  MCLB items are of 2D string array, you may convert each row's numerical values into string, construct them into 1D string array, and insert into the 2D string array for updating to the MCLB.

 

PS: Attached a very simple and basic code showing how numeric values is converted into string array, and updated to the MCLB.

There are many ways of achieving the same...

Message Edited by ian fung on 12-07-2009 11:06 AM
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 项奖励
2 条消息(共 9 条)
6,507 次查看

As of editing of a row's data, you may make use of the Double-Click method to obtain the double-clicked row, index that row's data for editing purpose before re-insert it back to the MCLB.

 

PS: attached is one of examples that obtains double-clicked row number. 

Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 项奖励
3 条消息(共 9 条)
6,501 次查看

是我没看懂吗?我的意思是在Multicolumn Listbox中输入number,该number要限定其取值,然后再将number输出到控制程序中,你能再帮我解释一下吗?我的理解是,Multicolumn Listbox里无论我输入number还是string,它都养成string格式来处理,而我要的是numeric格式的,输出也是numeric格式的,怎样转换这种格式呢?而且我还要定义listbox里的number的取值,这个又怎么实现?

0 项奖励
4 条消息(共 9 条)
6,499 次查看
首先谢谢你的回答~~
不过我还是有疑问,像你提供的的MCLB.vi的例子,Multicolumn Listbox只是用来接收了数据,也就是说我可以把numeric形式的参数输入到MCLB里面,但我的意思是直接在MCLB里面输入数字,再将此数字输出,毕竟在MCLB.vi的例子中,还是用到了3个numeric control控件,那如果是这样,就失去了我用MCLB的意义了,如果我需要多行多参数,我就必须罗列出多个numeric control,那就没有必要用MCLB了,我直接将N个numeric control定义好,再将其输出就行了,但我希望找到一个可以不用这么多numeric control的办法,难道labview没有一个控件可以实现本身就是列表形式(像数组一样),然后可以直接输入输出的吗?
0 项奖励
5 条消息(共 9 条)
6,497 次查看
解答
已被主题作者 413332985 接受

MCLB is for "displaying" purpose.

 

 

For parameters input...

 

Inputs of numerical parameters could be from a sub-VI that pops up for entries. Each numerical control's range may be set through its property node.

 

Once all parameters are entered, simply convert them (using the conversion functions found under String functions palette) into string, followed by constructing into string array for updating to the MCLB.

 

For editing of parameters...

 

By double-clicking on the MCLB's row, you may obtain the double-clicked row through its property method. With the obtained row number, you may index the array row, convert the elements into respective format i.e. string to numeric, and display them in a pop-up sub-VI for editing purposes.

 

Once edited, exiting the pop-up sub-VI will convert those parameters back to string array and update the MCLB.

 

 

You need to understand how MCLB works, as well as how to use conversion functions and controls properties. 

 

 

Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
6 条消息(共 9 条)
6,493 次查看

非常感谢你的辛苦回答!~因为MCLB看起来与我的预期结果非常接近,所以我并没有注意到它的作为显示的目的性,我再考虑下如何实现我的想法,再次感谢你!

0 项奖励
7 条消息(共 9 条)
6,482 次查看

Just a quick one...

 

MCLB2.JPG

 

Assuming that above is the mclb that display two rows of parameters.

On double-clicks, below sub-VI is pop-up, showing the item name and the value for editing purpose...

 

MCLB2 editor.JPG 

 

You will notice that 4.498 Mhz (string) from the mclb is now converted to numerical value for editing needs. Once edited, when user clicks the UPDATE button, this value is converted back to string and updated to the mclb.

 

If, for example, you have 10 parameters  in one row, you only need 10 numeric controls (place in the editor sub-VI). Regardless of which row of parameters you double-clicked, the same editor sub-VI will be used for editing purpose.

 

Hope above make sense to you 🙂 

 

Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
8 条消息(共 9 条)
6,459 次查看
Thx a lot, it's very helpful.
0 项奖励
9 条消息(共 9 条)
6,454 次查看