LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Transfering a boolean signal out of a while loop after every iteration

I am using a "Mask and Limit" to produce boolean signals based on data being collected. Inside the loop, this will obviously produce a boolean with every iteration. However, I need this boolean signal to be available outside of the loop with every iteration as well. Is there a way to make this constant stream of booleans available outside of the loop?

 

Thank you in advance.

0 Kudos
Message 1 of 12
(5,155 Views)
You can use variable if your program won't create racing conditions....
if not use notifier /functional global/ queues To update to outside loop..
Message 2 of 12
(5,140 Views)
This is what you would use a producer-consumer design pattern for. Here is a good place to start.

http://www.notatamelion.com/2014/10/07/build-a-proper-labview-produceconsumer-pattern/

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 3 of 12
(5,130 Views)

As a side question, would having an indicator inside the loop passing the continuous booleans to a local variable outside the loop work? Or, even better, notifiers?

0 Kudos
Message 4 of 12
(5,121 Views)
Local variables "work" in the sense that they would pass out the data, but would cause a bunch of other problems like race conditions, catching transitions, etc. Notifiers would be a (small) step in the right direction, but they have other limitations.

What I try to do in the post I cited (and the ones following) was to walk you through the process of looking at options and deciding what you really need for your application

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 12
(5,089 Views)
Addition to mike post ...
In case of local variables there is chance that previous iteration value can be taken for process in the outside loop....

So it's better to use notifier, which will wait for new value to process the outside loop...
0 Kudos
Message 6 of 12
(5,080 Views)
While local variables can allow you to process the same data multiple times, notifiers create the potential of missing data updates all together. If a notification is sent and you don't read it before a second one is sent, the second notification will overwrite the first and you lose the data contained in the first notification.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 12
(5,071 Views)
Agree with your point @mike
0 Kudos
Message 8 of 12
(5,027 Views)

You're looking for the word "queue."  Let the notifiers go.

0 Kudos
Message 9 of 12
(4,972 Views)
The problem with queues is that if you want the rest of the application to be event-driven, queues don't integrate well. You often end up needing to poll the queue which defeats one of the main reasons to use an event-driven structure in the first place -- efficiency.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 10 of 12
(4,915 Views)