LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make code that is after a while loop to be executed after the while loop is stopped?

Solved!
Go to solution

Hi Friends,

 

I have a while loop for data collection followed by an interpolation data process. I want the data process still work after the stop button is clicked to stop the data collection while loop. 

 

The program worked fine  when  a for loop was used for data collection, however, the interpolation data process stopped working after replacing the for loop with a while loop.  

 

Please find attached two VIs and and input are appreciated.

 

Thanks,

Gu

0 Kudos
Message 1 of 5
(1,970 Views)

Can you explain more what you mean about the interpolation not working? When I run your while loop version and stop it after about 20 iterations, I get an output that looks very similar to your for loop version. So I'm not sure what exactly the problem is.

0 Kudos
Message 2 of 5
(1,946 Views)

I feel a little bit silly suggesting this, but I just want to make sure: you are pressing the "Stop" button and not the "Abort Execution" button right?

0 Kudos
Message 3 of 5
(1,940 Views)
Solution
Accepted by topic author edmonton

I tried this using LabVIEW 2018 and it seemed to work fine.  I had a little difficulty stopping the While Loop at 20 iterations, so I "cheated" and replaced the Stop button with an "is equal to 20" comparison that looked at the XY Graph Count.  Note that you might have "fooled yourself" as the Array indicator on the "While" version is looking at elements 30 and above, all of which are null, while the "For" version starts looking at Offset 0 and sees data.

 

I also tried this with LabVIEW 2016 (the oldest I have conveniently available) and saw the same thing.

 

Bob Schor

0 Kudos
Message 4 of 5
(1,937 Views)

Hi   All Guys who replied and reviewed my post,

 

Yes,  the two versions work the same. 

 

I tried the while loop version  immediately after changing the for loop version to the while loop version, it did not work. The interpolation was not executed. 

 

However, after my supper and reading the 3 replies, I reloaded the while loop version and run it realizing that it works fine. The issue might be related to my computer issue rather the code.  I closed the while loop VI and also LabVIEW program for supper, it just work fine after reload LabVIEW and the VI.

 

I am sorry for troubling all of you guys.

Gu

 

0 Kudos
Message 5 of 5
(1,928 Views)