程序见附件。
功能描述:点击登记/读取键,进入子VI 1,可选登记还是读取,登记有登记病人信息或保存肌电图,登记的话可以再进入子VI2,保存相关信息;读取也是一样,就是将之前登记过的文件读出来。
问题出现了,我点击读取,将之前保存过的一个文件(这里请大家先随便登记点什么,姓名那些、强度那些都随便改改保存)包括病人相关信息及强度等参数读取出来,结果就显示在主函数界面相应位置上,但当我再点登记/读取键,进入子VI 1之后,哪怕我什么都不做,直接点击返回,我之前读取的病人信息就全部清零了,同样的情况:如果我在强度等参数处输入数据,然后点击登记,一直到保存,保存完了之后我的参数也随即清空了,这样的情况怎么产生的呢?我如何才能只保存相关数据,但并不在主VI上清空它们呢?
请大家看看~~
已解决! 转到解答。
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
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
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.
反应了好久才明白为什么如果cancel点击,会直接给传送false值,原来是我程序里确定项的false case什么都没有定义,失败啊,我现在修改的是,false那里让它把之前的数据保留传回去,这样即便点了cancel,也不会影响它的值,而如果确定的话,就把新的值传过去,复杂了点,不过总算是搞定啦,谢谢你哈