Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to search a boolean array for a single F value?

I've constructed a simple, 1-D boolean array showing comparison results between expected and actual values, read over the serial port. I want to have a single LED indicator on the Front Panel that turns ON when all of the array elements are True. If only a single array element is False, I want the front-panel LED indicator to turn OFF.

 

This would be straightforward in a traditional programming language: set an initial, global boolean scalar variable to "False", then sequentially test every array element (via a 'for' loop). If any of the boolean array elements is "False", then set the global scalar to "False" as well.

 

But I can't visualize how to implement this For loop in LabView. How to search the boolean array for any "False" value, and if found, set a Front Panel indicator to turn off?

 

I have attached a short program that attempts to illustrate the issue. Most of the program can be ignored: the "For" loop on the far right actually sets the value of each boolean array element. I would think that the global scalar value could somehow be checked somewhere in that "For" loop, also ....

 

I would also welcome any suggestion for how I could avoid hard-wiring the loop-count in that "For" loop to a constant (in this case, to the value '12'). Shouldn't the "For" loop be able to deduce the size of the array automatically?

 

Thanks.

0 Kudos
Message 1 of 6
(3,290 Views)

I don't think your text based solution is very simple and I know it's simple in LabVIEW. Look on the array palette.

 

 

 

p.s. You really want to keep similar posts like this to the LabVIEW board. It has nothing to do with Instrument Control.

 

You also don't need to wire any value to the 'N' terminal of a for loop when you pass in an array. You might also want to check out the free LabVIEW  training

Message Edited by Dennis Knutson on 09-04-2008 07:30 PM
Message Edited by Dennis Knutson on 09-04-2008 07:31 PM
Message 2 of 6
(3,286 Views)
Sorry. Meant to say Boolean palette.
0 Kudos
Message 3 of 6
(3,275 Views)

Thanks, Dennis. I wasn't aware of the "boolean palette" until you pointed it out. This contained the perfect function. Regarding my reference to the "serial port", you are correct that my test case was poorly identified. This was a consequence of the test case itself: the actual application I'm working on involved serial port communication, and I should have removed the reference since it was not part of the test case.

 

I appreciate the quick feedback.

 

- Eric

 

0 Kudos
Message 4 of 6
(3,252 Views)

Hi

 

just to make sure that LabVIEW is a normal language

this is another LabVIEW way that looks more like your algoritm:Labview with for loop

 

Message Edited by Albert Geven on 09-05-2008 09:14 PM
greetings from the Netherlands
0 Kudos
Message 5 of 6
(3,244 Views)

Albert -- thank you for the additional reply. Yes, your proposal is closer to the traditional algorithm I had in mind. I appreciate the insight. My LabView learning curve continues to climb ...

 

Regards,

 

- Eric Means

0 Kudos
Message 6 of 6
(3,236 Views)