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

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

用子VI登记读取相关信息,完成后会把原数据清零,怎么解决

已解决!
转到解答

程序见附件。

功能描述:点击登记/读取键,进入子VI 1,可选登记还是读取,登记有登记病人信息或保存肌电图,登记的话可以再进入子VI2,保存相关信息;读取也是一样,就是将之前登记过的文件读出来。

问题出现了,我点击读取,将之前保存过的一个文件(这里请大家先随便登记点什么,姓名那些、强度那些都随便改改保存)包括病人相关信息及强度等参数读取出来,结果就显示在主函数界面相应位置上,但当我再点登记/读取键,进入子VI 1之后,哪怕我什么都不做,直接点击返回,我之前读取的病人信息就全部清零了,同样的情况:如果我在强度等参数处输入数据,然后点击登记,一直到保存,保存完了之后我的参数也随即清空了,这样的情况怎么产生的呢?我如何才能只保存相关数据,但并不在主VI上清空它们呢?

 

请大家看看~~

              

0 项奖励
1 条消息(共 9 条)
5,393 次查看
解答
接受人 413332985

That's desired results according to your program.

 

You can use high light run to view the data returned from SubVIs, I can say when you press cancel on the VI2, the VI 2 Return the datas all with default values, because if you press cancel, you haven't done any thing to these controls, so they can only return a default value, for string, just NULL string, for numeric, just 0

 

So I suggest that you can return a status value from SubVI, the status value should be a bool type, name it as canceled, if you press cancel in VI 2, it will return a true in canceled, you just don't update the indicators on the Main VI

 

Hope that will help you

Best Regards

Hu Yu
2 条消息(共 9 条)
5,384 次查看
我好像大概了解了您要表达的意思,是说如果我操作cancel,那么只会有boolean值的传输,而其他参数就不会影响吗?可是在实现上,是要建一个boolean在循环外面吗?好像也不行啊,点了cancel其他参数的false值与boolean的true值都发生。。。看来我还是没搞明白,麻烦您再稍微指点下行不
0 项奖励
3 条消息(共 9 条)
5,378 次查看

Hi

 

In SubVI, you can determine the output of the canceled terminal according to the  status of the cancel button,

 

In Main VI, you can modify your output indicators using a case structure like below

 

update.PNG

Message Edited by NIhuyu on 01-29-2010 01:39 AM
Best Regards

Hu Yu
0 项奖励
4 条消息(共 9 条)
5,372 次查看
好像这样的话,我如果想读取数据出来,也跟着受影响了吧~~因为false的时候,我的数据才能update,可我正常操作读完了返回的时候,cancel为true了,数据不跟着走噢,我的理解对吗?
0 项奖励
5 条消息(共 9 条)
5,365 次查看

That's why there will be a "canceled?" terminal,  you see, if you cancel the operation, the "canceled?" terminal should be true, but if you successfully complete the operation, the "canceled?" terminal should be false, the "canceled?" terminal should not be a constant, its value depends on the operations in your VI2,

 

So, you must modify your VI2, in order to make the "canceled?" terminal output false when successfully complete operation, and output true when cancel operation.

Best Regards

Hu Yu
0 项奖励
6 条消息(共 9 条)
5,345 次查看

反应了好久才明白为什么如果cancel点击,会直接给传送false值,原来是我程序里确定项的false case什么都没有定义,失败啊,我现在修改的是,false那里让它把之前的数据保留传回去,这样即便点了cancel,也不会影响它的值,而如果确定的话,就把新的值传过去,复杂了点,不过总算是搞定啦,谢谢你哈

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

您的第一个回答解释了数据传输的问题,也提供了解决思路,所以我就把正解选定为它啦~

0 项奖励
8 条消息(共 9 条)
5,327 次查看

Not at all!

 

Glad you solve your problem!

Best Regards

Hu Yu
0 项奖励
9 条消息(共 9 条)
5,286 次查看