LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

executing code in a while loop with an event structure in it


@floragm wrote:

... I am trying to capture data only when a button is pressed, but I need the data to continuously be graphed in the while loop, and only capture it when the button is pressed. What really happens is contrary to instructed and what is expected to happen.


You are not making a lot of sense, so please follow the above, start a new thread, and show us your VI.

Dataflow dictates that a loop cannot complete the current iteration until all content has completed. Your event structure only completes if an event occurs, so if you want to still spin the loop occasionally, add a timeout event with a reasonable timeout.

A graph retains the current data until overwritten with new data, so I don't understand why you need to graph "continuously" even if there is no new data. A graph only needs to be updated when the data changes. Are you using a chart instead of a graph?

If the graphing is a completely separate process, you can use a parallel while loop for that.

0 Kudos
Message 11 of 12
(221 Views)

OK, now that you mentioned that the while loop cannot complete the current iteration until all content is complete - I get it. I understand now. I added a small timeout in the event structure to have it complete the iteration of the while loop and the code runs OK.

Thanks.

0 Kudos
Message 12 of 12
(219 Views)